diff options
author | Mario <mario@mariovavti.com> | 2020-08-20 08:43:13 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2020-08-20 08:43:13 +0000 |
commit | e55a1a6aa8fe55d20b588f0223a15018053bfd48 (patch) | |
tree | 0ef7ab566e09430d61d95013af48e862a0023858 | |
parent | 21e5b05b149736bcc49a662d713be5deadb32c16 (diff) | |
download | volse-hubzilla-e55a1a6aa8fe55d20b588f0223a15018053bfd48.tar.gz volse-hubzilla-e55a1a6aa8fe55d20b588f0223a15018053bfd48.tar.bz2 volse-hubzilla-e55a1a6aa8fe55d20b588f0223a15018053bfd48.zip |
fix item deletion
-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; + } |