diff options
Diffstat (limited to 'Zotlabs/Lib')
-rw-r--r-- | Zotlabs/Lib/Activity.php | 27 | ||||
-rw-r--r-- | Zotlabs/Lib/Libzot.php | 2 |
2 files changed, 20 insertions, 9 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 7ad6c91ae..7cc77f124 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -643,8 +643,19 @@ class Activity { $ret['obj'] = []; } + $ret['type'] = self::activity_mapper($i['verb']); + + + if (intval($i['item_deleted'])) { - $ret['type'] = 'Delete'; + $is_response = false; + if (in_array($ret['type'], [ 'Like', 'Dislike', 'Accept', 'Reject', 'TentativeAccept', 'TentativeReject' ])) { + $ret['type'] = 'Undo'; + $is_response = true; + } + else { + $ret['type'] = 'Delete'; + } $ret['id'] = str_replace('/item/','/activity/',$i['mid']) . '#delete'; $actor = self::encode_person($i['author'],false); if ($actor) @@ -652,7 +663,7 @@ class Activity { else return []; - if ($i['obj']) { + if ($i['obj'] && !$is_response) { if (! is_array($i['obj'])) { $i['obj'] = json_decode($i['obj'],true); } @@ -663,7 +674,7 @@ class Activity { return []; } else { - $obj = self::encode_item($i,$activitypub); + $obj = self::encode_item($i); if ($obj) $ret['object'] = $obj; else @@ -674,8 +685,6 @@ class Activity { return $ret; } - $ret['type'] = self::activity_mapper($i['verb']); - if($ret['type'] === 'emojiReaction') { // There may not be an object for these items for legacy reasons - it should be the conversation parent. $p = q("select * from item where mid = '%s' and uid = %d", @@ -1070,6 +1079,8 @@ class Activity { 'http://purl.org/zot/activity/attendno' => 'Reject', 'http://purl.org/zot/activity/attendmaybe' => 'TentativeAccept', 'Invite' => 'Invite', + 'Delete' => 'Delete', + 'Undo' => 'Undo' ]; call_hooks('activity_mapper',$acts); @@ -1117,6 +1128,8 @@ class Activity { 'http://purl.org/zot/activity/attendno' => 'Reject', 'http://purl.org/zot/activity/attendmaybe' => 'TentativeAccept', 'Invite' => 'Invite', + 'Delete' => 'Delete', + 'Undo' => 'Undo' ]; call_hooks('activity_decode_mapper',$acts); @@ -2087,12 +2100,10 @@ class Activity { $s['edited'] = datetime_convert(); } - if($act->type === 'Tombstone' || $act->type === 'Delete' || ($act->type === 'Create' && $act->obj['type'] === 'Tombstone')) { + if(in_array($act->type, [ 'Delete', 'Undo', 'Tombstone' ]) || ($act->type === 'Create' && $act->obj['type'] === 'Tombstone')) { $s['item_deleted'] = 1; } - - $s['obj_type'] = self::activity_obj_decode_mapper($act->obj['type']); if($s['obj_type'] === ACTIVITY_OBJ_NOTE && $s['mid'] !== $s['parent_mid']) { $s['obj_type'] = ACTIVITY_OBJ_COMMENT; diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index a6db9e431..87da5ff7a 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -2124,8 +2124,8 @@ class Libzot { dbesc($sender), dbesc($sender), dbesc($sender), - dbesc($item['mid']), dbesc(str_replace('/activity/', '/item/', $item['mid'])), + dbesc(str_replace('/item/', '/activity/', $item['mid'])), intval($uid) ); |