Merge branch 'dev' of /home/macgirvin/z into dev

This commit is contained in:
nobody 2021-05-19 15:51:45 -07:00
commit ae6aa577e4
10 changed files with 21 additions and 17 deletions

View file

@ -81,9 +81,13 @@ Announce and relay activities use two mechanisms. As well as the Announce activi
Discussion (2021-04-17): In the email world this type of conflict is resolved by the use of the reply-to header (e.g. in this case reply to the group rather than to the author) as well as the concept of a 'sender' which is different than 'from' (the author). We will soon be modelling the first one in ActivityPub with the use of 'replyTo'. If you see 'replyTo' in an activity it indicates that replies SHOULD go to that address rather than the author's inbox. We will implement this first and come up with a proposal for 'sender' if this gets any traction. If enough projects support these constructs we can eliminate the multiple relay mechanisms and in the process make ActivityPub much more versatile when it comes to organisational and group communications. Our primary use case for 'sender' is to provide an ActivityPub origin to a message that was imported from another system entirely (such as Diaspora or from RSS source). In this case we would set 'attributedTo' to the remote identity that authored the content, and 'sender' to the person that posted it in ActivityPub.
Emoji Reactions
We consider a reply message containing exactly one emoji and no other text or markup to be an emoji reaction. We indicate this state internally on receipt but do nothing to identify it specifically to downstream recipients.
Mastodon Custom Emojis
Mastodon Custom Emojis are only supported for post content. Display names and message titles (ActivityStreams "name" field) are considered text only fields and embedded images (the mechanism behind custom emojis) are not supported in these locations.
Mastodon Custom Emojis are only supported for post content and are not considered as emoji reactions. Display names and message titles (ActivityStreams "name" field) are considered text only fields and embedded images (the mechanism behind custom emojis) are not supported in these locations.
Mentions and private mentions

View file

@ -305,7 +305,7 @@ class Notifier {
return;
}
if (in_array($target_item['verb'], [ ACTIVITY_FOLLOW, ACTIVITY_UNFOLLOW ])) {
if (in_array($target_item['verb'], [ ACTIVITY_FOLLOW, ACTIVITY_IGNORE ])) {
logger('not fowarding follow|unfollow->note activity');
return;
}

View file

@ -1600,7 +1600,7 @@ class Activity {
'http://purl.org/zot/activity/dislike' => 'Dislike',
'http://activitystrea.ms/schema/1.0/tag' => 'Add',
'http://activitystrea.ms/schema/1.0/follow' => 'Follow',
'http://activitystrea.ms/schema/1.0/unfollow' => 'Unfollow',
'http://activitystrea.ms/schema/1.0/unfollow' => 'Ignore',
];
call_hooks('activity_mapper',$acts);
@ -2011,9 +2011,9 @@ class Activity {
}
}
if ($links) {
if (is_array($links) && $links) {
foreach ($links as $link) {
if (array_key_exists('mediaType',$link) && $link['mediaType'] === 'text/html') {
if (is_array($link) && array_key_exists('mediaType',$link) && $link['mediaType'] === 'text/html') {
$profile = $link['href'];
}
}
@ -2491,10 +2491,9 @@ class Activity {
// Within our family of projects, Follow/Unfollow of a thread is an internal activity which should not be transmitted,
// hence if we receive it - ignore or reject it.
// Unfollow is not defined by ActivityStreams, which prefers Undo->Follow.
// This may have to be revisited if AP projects start using Follow for objects other than actors.
if (in_array($act->type, [ ACTIVITY_FOLLOW, ACTIVITY_UNFOLLOW ])) {
if (in_array($act->type, [ ACTIVITY_FOLLOW, ACTIVITY_IGNORE ])) {
return false;
}

View file

@ -110,7 +110,7 @@ class Activity extends Controller {
$portable_id = EMPTY_STR;
$item_normal = " and item.item_hidden = 0 and item.item_type = 0 and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_blocked = 0 and not verb in ( 'Follow', 'Unfollow' ) ";
$item_normal = " and item.item_hidden = 0 and item.item_type = 0 and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_blocked = 0 and not verb in ( 'Follow', 'Ignore' ) ";
$i = null;

View file

@ -23,7 +23,7 @@ class Conversation extends Controller {
$portable_id = EMPTY_STR;
$item_normal = " and item.item_hidden = 0 and item.item_type = 0 and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_blocked = 0 and not verb in ( 'Follow', 'Unfollow' ) ";
$item_normal = " and item.item_hidden = 0 and item.item_type = 0 and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_blocked = 0 and not verb in ( 'Follow', 'Ignore' ) ";
$i = null;

View file

@ -156,7 +156,7 @@ class Item extends Controller {
}
$portable_id = EMPTY_STR;
$item_normal = " and item.item_hidden = 0 and item.item_type = 0 and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_blocked = 0 and not verb in ( 'Follow', 'Unfollow' ) ";
$item_normal = " and item.item_hidden = 0 and item.item_type = 0 and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_blocked = 0 and not verb in ( 'Follow', 'Ignore' ) ";
$i = null;

View file

@ -27,7 +27,7 @@ class Subthread extends Controller {
$activity = ACTIVITY_FOLLOW;
}
elseif (argv(1) === 'unsub') {
$activity = ACTIVITY_UNFOLLOW;
$activity = ACTIVITY_IGNORE;
}
$i = q("select * from item where id = %d and uid = %d",
@ -132,7 +132,7 @@ class Subthread extends Controller {
if ($activity === ACTIVITY_FOLLOW) {
$bodyverb = t('%1$s is following %2$s\'s %3$s');
}
if ($activity === ACTIVITY_UNFOLLOW) {
if ($activity === ACTIVITY_IGNORE) {
$bodyverb = t('%1$s stopped following %2$s\'s %3$s');
}

View file

@ -492,7 +492,7 @@ define ( 'ACTIVITY_LIKE', 'Like' );
define ( 'ACTIVITY_DISLIKE', 'Dislike' );
define ( 'ACTIVITY_SHARE', 'Announce' );
define ( 'ACTIVITY_FOLLOW', 'Follow' );
define ( 'ACTIVITY_UNFOLLOW', 'Unfollow');
define ( 'ACTIVITY_IGNORE', 'Ignore');
define ( 'ACTIVITY_OBJ_COMMENT', 'Note' );
define ( 'ACTIVITY_OBJ_NOTE', 'Note' );

View file

@ -2441,7 +2441,7 @@ function send_status_notifications($post_id,$item) {
// check for an unfollow thread activity - we should probably decode the obj and check the id
// but it will be extremely rare for this to be wrong.
if(($xx['verb'] === ACTIVITY_UNFOLLOW)
if(($xx['verb'] === ACTIVITY_IGNORE)
&& ($xx['obj_type'] === ACTIVITY_OBJ_NOTE || $xx['obj_type'] === ACTIVITY_OBJ_PHOTO)
&& ($xx['parent'] != $xx['id']))
$unfollowed = true;
@ -4112,7 +4112,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
}
if (! (isset($arr['include_follow']) && intval($arr['include_follow']))) {
$item_normal .= " and not verb in ( 'Follow' , 'Unfollow' ) ";
$item_normal .= " and not verb in ( 'Follow' , 'Ignore' ) ";
}
if (isset($arr['star']) && $arr['star']) {

View file

@ -283,7 +283,7 @@ function purify_html($s, $opts = []) {
$def->addElement('footer', 'Block', 'Flow', 'Common');
//Inline
$def->addElement('button', 'Inline', 'Inline', 'Common');
$def->addElement('mark', 'Inline', 'Inline', 'Common');
if(in_array('allow_position', $opts)) {
$cssDefinition = $config->getCSSDefinition();
@ -846,9 +846,10 @@ function get_tags($s) {
$ret = [];
$match = [];
// ignore anything in a code or svg block
// ignore anything in a code or svg block or HTML tag
$s = preg_replace('/\[code(.*?)\](.*?)\[\/code\]/sm','',$s);
$s = preg_replace('/\<(.*?)\>/sm','',$s);
$s = preg_replace('/\[svg(.*?)\](.*?)\[\/svg\]/sm','',$s);
// ignore anything in [style= ]