diff options
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Daemon/Notifier.php | 5 | ||||
-rw-r--r-- | Zotlabs/Lib/Activity.php | 38 |
2 files changed, 28 insertions, 15 deletions
diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php index 8993d8aee..0f5393f0a 100644 --- a/Zotlabs/Daemon/Notifier.php +++ b/Zotlabs/Daemon/Notifier.php @@ -361,8 +361,9 @@ class Notifier { $encoded_item = encode_item($target_item); - // activitystreams version - $m = get_iconfig($target_item,'activitystreams','signed_data'); + // activitystreams version (recreate for deleted items) + $m = ((intval($target_item['item_deleted'])) ? '' : get_iconfig($target_item,'activitystreams','signed_data')); + if($m) { $activity = json_decode($m,true); } diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 25f19510d..83c04c042 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -314,14 +314,6 @@ class Activity { else { $objtype = self::activity_obj_mapper($i['obj_type']); } - - if(intval($i['item_deleted'])) { - $ret['type'] = 'Tombstone'; - $ret['formerType'] = $objtype; - $ret['id'] = ((strpos($i['mid'],'http') === 0) ? $i['mid'] : z_root() . '/item/' . urlencode($i['mid'])); - return $ret; - } - if ($i['obj']) { $ret = Activity::encode_object($i['obj']); @@ -651,16 +643,36 @@ class Activity { $ret['obj'] = []; } - if(intval($i['item_deleted'])) { - $ret['type'] = 'Tombstone'; - $ret['formerType'] = self::activity_obj_mapper($i['obj_type']); - $ret['id'] = ((strpos($i['mid'],'http') === 0) ? $i['mid'] : z_root() . '/item/' . urlencode($i['mid'])); + if (intval($i['item_deleted'])) { + $ret['type'] = 'Delete'; + $ret['id'] = str_replace('/item/','/activity/',$i['mid']) . '#delete'; $actor = self::encode_person($i['author'],false); - if($actor) + if ($actor) $ret['actor'] = $actor; else return []; + + if ($i['obj']) { + if (! is_array($i['obj'])) { + $i['obj'] = json_decode($i['obj'],true); + } + $obj = self::encode_object($i['obj']); + if ($obj) + $ret['object'] = $obj; + else + return []; + } + else { + $obj = self::encode_item($i); + if ($obj) + $ret['object'] = $obj; + else + return []; + } + + $ret['to'] = [ ACTIVITY_PUBLIC_INBOX ]; return $ret; + } |