diff options
author | Mario <mario@mariovavti.com> | 2020-10-01 11:51:20 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2020-10-01 11:51:20 +0000 |
commit | 86117c88595cf97a6173fabcb9e3b0d5ec6b1d09 (patch) | |
tree | e078cc073bc8bccd2547cd8ac23aa62dd43446c0 /Zotlabs/Lib | |
parent | 96c4c72ee36ebb19252be724ddb485a05337cb23 (diff) | |
download | volse-hubzilla-86117c88595cf97a6173fabcb9e3b0d5ec6b1d09.tar.gz volse-hubzilla-86117c88595cf97a6173fabcb9e3b0d5ec6b1d09.tar.bz2 volse-hubzilla-86117c88595cf97a6173fabcb9e3b0d5ec6b1d09.zip |
more delete fixes
Diffstat (limited to 'Zotlabs/Lib')
-rw-r--r-- | Zotlabs/Lib/Activity.php | 23 | ||||
-rw-r--r-- | Zotlabs/Lib/Libzot.php | 9 |
2 files changed, 24 insertions, 8 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 6fac0c717..7cc77f124 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -645,9 +645,13 @@ class Activity { $ret['type'] = self::activity_mapper($i['verb']); + + if (intval($i['item_deleted'])) { + $is_response = false; if (in_array($ret['type'], [ 'Like', 'Dislike', 'Accept', 'Reject', 'TentativeAccept', 'TentativeReject' ])) { $ret['type'] = 'Undo'; + $is_response = true; } else { $ret['type'] = 'Delete'; @@ -659,7 +663,24 @@ class Activity { else return []; - $ret['object'] = str_replace('/item/','/activity/',$i['mid']); + if ($i['obj'] && !$is_response) { + 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; } diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index 9b4b05878..87da5ff7a 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -2116,11 +2116,6 @@ class Libzot { $item_found = false; $post_id = 0; - $m = parse_url($item['mid']); - unset($m['fragment']); - $normalised = unparse_url($m); - - // reactions such as like and dislike could have an mid with /activity/ in it. // Check for both forms in order to prevent duplicates. @@ -2129,8 +2124,8 @@ class Libzot { dbesc($sender), dbesc($sender), dbesc($sender), - dbesc($normalised), - dbesc(str_replace('/activity/', '/item/', $normalised)), + dbesc(str_replace('/activity/', '/item/', $item['mid'])), + dbesc(str_replace('/item/', '/activity/', $item['mid'])), intval($uid) ); |