context is a thing now

This commit is contained in:
nobody 2021-04-16 23:53:35 -07:00
parent 7bca3064d9
commit 87de776a43
2 changed files with 29 additions and 13 deletions

View file

@ -91,11 +91,9 @@ By default the mention format is '@Display Name', but other options are availabl
(Mastodon) Comment Notifications
Our projects send comment notifications if somebody replies to a post you either created or have previously interacted with in some way. They also are able to send a "mention" notification if you were mentioned in the post. This differs from Mastodon which does not appear to support comment notifications at all and only provides mention notifications. For this reason, Mastodon users don't typically get notified unless the author they are replying to is mentioned in the post. We provide this mention in the 'tag' field of the generated Activity, but normally don't include it in the message body, as we don't actually require mentions that were created for the sole purpose of triggering a notification.
Our projects send comment notifications if somebody replies to a post you either created or have previously interacted with in some way. They also are able to send a "mention" notification if you were mentioned in the post. This differs from Mastodon which does not appear to support comment notifications at all and only provides mention notifications. For this reason, Mastodon users don't typically get notified unless the author they are replying to is mentioned in the post. We provide this mention in the 'tag' field of the generated Activity, but normally don't include it in the message body, as we don't actually require mentions that were created for the sole purpose of triggering a comment notification.
Conversation Completion
(2021-04-17) It's easy to fetch missing pieces of a conversation going "upstream", but there is no agreed-on method to fetch a complete conversation from the viewpoint of the origin actor. We intend to use 'context' to return a collection containing the entire converstion and would like to see participation by other projects to provide the most complete conversations as practical as seen by the initator. This is expected in Q2 2021. Use of 'replies' for this purpose will be provided to ActivityPub viewers as well but that collection does not contain the origin post. It still requires traversing the conversation upstream, whereas carrying a 'context' field throughout the conversation would allow a single authoritative fetchable pointer of the thread head and all its descendants.
So our plan is to re-use a supplied 'context' on all descendants, much as we do with ostatus:conversation today, and provide a collection at the context endpoint. Once this is in place we will begin the process of deprecating ostatus:conversation.
(2021-04-17) It's easy to fetch missing pieces of a conversation going "upstream", but there is no agreed-on method to fetch a complete conversation from the viewpoint of the origin actor and upstream fetching only provides a single conversation branch, rather than the entire tree. We provide 'context' as a URL to a collection containing the entire conversation (all known branches) as seen by its creator. This requires special treatment and is very similar to ostatus:conversation in that if context is present, it needs to be replicated in conversation descendants. We still support ostatus:conversation but usage is deprecated. We do not use 'replies' to achieve the same purposes because 'replies' only applies to direct descendants at any point in the conversation tree.

View file

@ -745,7 +745,10 @@ class Activity {
if (! in_array($ret['type'],[ 'Create','Update','Accept','Reject','TentativeAccept','TentativeReject' ])) {
$ret['inReplyTo'] = $i['thr_parent'];
$cnv = get_iconfig($i['parent'],'ostatus','conversation');
$cnv = get_iconfig($i['parent'],'activitypub','context');
if (! $cnv) {
$cnv = get_iconfig($i['parent'],'ostatus','conversation');
}
if (! $cnv) {
$cnv = $ret['parent_mid'];
}
@ -753,15 +756,19 @@ class Activity {
}
if (! (isset($cnv) && $cnv)) {
// This method may be called before the item is actually saved - in which case there is no id and IConfig cannot be used
if ($i['id']) {
$cnv = get_iconfig($i,'activitypub','context');
if (! $cnv) {
$cnv = get_iconfig($i,'ostatus','conversation');
}
else {
if (! $cnv) {
$cnv = $i['parent_mid'];
}
}
if (isset($cnv) && $cnv) {
if (strpos($cnv,z_root()) === 0) {
$cnv = str_replace(['/item/','/activity/'],[ '/conversation/', '/conversation/' ], $cnv);
}
$ret['context'] = $cnv;
$ret['conversation'] = $cnv;
}
@ -1065,7 +1072,10 @@ class Activity {
if ($i['mid'] !== $i['parent_mid']) {
$ret['inReplyTo'] = $i['thr_parent'];
$cnv = get_iconfig($i['parent'],'ostatus','conversation');
$cnv = get_iconfig($i['parent'],'activitypub','context');
if (! $cnv) {
$cnv = get_iconfig($i['parent'],'ostatus','conversation');
}
if (! $cnv) {
$cnv = $ret['parent_mid'];
}
@ -1091,14 +1101,19 @@ class Activity {
}
}
if (! isset($cnv)) {
if ($i['id']) {
$cnv = get_iconfig($i,'activitypub','context');
if (! $cnv) {
$cnv = get_iconfig($i,'ostatus','conversation');
}
else {
if (! $cnv) {
$cnv = $i['parent_mid'];
}
}
if ($cnv) {
if (isset($cnv) && $cnv) {
if (strpos($cnv,z_root()) === 0) {
$cnv = str_replace(['/item/','/activity/'],[ '/conversation/', '/conversation/' ], $cnv);
}
$ret['context'] = $cnv;
$ret['conversation'] = $cnv;
}
@ -3318,11 +3333,14 @@ class Activity {
return;
}
if ($act->obj['context']) {
set_iconfig($item,'activitypub','context',$act->obj['context'],1);
}
if ($act->obj['conversation']) {
set_iconfig($item,'ostatus','conversation',$act->obj['conversation'],1);
}
set_iconfig($item,'activitypub','recips',$act->raw_recips);
if (! (isset($act->data['inheritPrivacy']) && $act->data['inheritPrivacy'])) {