diff options
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Lib/Activity.php | 21 | ||||
-rw-r--r-- | Zotlabs/Lib/Libzot.php | 6 |
2 files changed, 23 insertions, 4 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 7de2ca7ec..7ad6c91ae 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -652,13 +652,28 @@ class Activity { else return []; - $ret['object'] = str_replace('/item/','/activity/',$i['mid']); + 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,$activitypub); + if ($obj) + $ret['object'] = $obj; + else + return []; + } + $ret['to'] = [ ACTIVITY_PUBLIC_INBOX ]; return $ret; - } - $ret['type'] = self::activity_mapper($i['verb']); if($ret['type'] === 'emojiReaction') { diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index ce9536cd4..a6db9e431 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -2116,12 +2116,16 @@ class Libzot { $item_found = false; $post_id = 0; + // reactions such as like and dislike could have an mid with /activity/ in it. + // Check for both forms in order to prevent duplicates. + $r = q("select * from item where ( author_xchan = '%s' or owner_xchan = '%s' or source_xchan = '%s' ) - and mid = '%s' and uid = %d limit 1", + and mid IN ('%s', '%s') and uid = %d limit 1", dbesc($sender), dbesc($sender), dbesc($sender), dbesc($item['mid']), + dbesc(str_replace('/activity/', '/item/', $item['mid'])), intval($uid) ); |