From f0ee4c3cef6c148bd397ad6a1e71ce86aa43565a Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 26 Jan 2021 10:35:24 +0000 Subject: port fix from zap: catch a complex edge case where some public stream comments were not being delivered and should have been --- Zotlabs/Lib/Activity.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Zotlabs/Lib/Activity.php') diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 8ad114a4d..388d74d91 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -292,7 +292,7 @@ class Activity { $ret = [ 'id' => z_root() . '/' . $id, 'type' => $type, - 'totalItems' => count($items), + 'totalItems' => $total, ]; } @@ -2525,6 +2525,9 @@ class Activity { intval($channel['channel_id']) ); if ($p) { + // set the owner to the owner of the parent + $item['owner_xchan'] = $p[0]['owner_xchan']; + // check permissions against the author, not the sender $allowed = perm_is_allowed($channel['channel_id'], $item['author_xchan'], 'post_comments'); if ((!$allowed)/* && $permit_mentions*/) { @@ -2560,9 +2563,8 @@ class Activity { $allowed = true; // reject public stream comments that weren't sent by the conversation owner - if ($is_sys_channel && $pubstream && $item['owner_xchan'] !== $observer_hash) { - // TODO: check why? This would make it impossible to fetch externals via zotfeed where $observer_hash = sys channel - // $allowed = false; + if ($is_sys_channel && $pubstream && $item['owner_xchan'] !== $observer_hash && ! $fetch_parents) { // TODO: check why? This would make it impossible to fetch externals via zotfeed where $observer_hash = sys channel + $allowed = false; } } -- cgit v1.2.3