From 7cdbcf411f71dff064cdbfe036b3d519640d98c2 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 12 Aug 2020 13:54:19 +0000 Subject: [PATCH] Clarify the functionality --- src/Model/UserItem.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Model/UserItem.php b/src/Model/UserItem.php index 1680dd2727..11446f6e81 100644 --- a/src/Model/UserItem.php +++ b/src/Model/UserItem.php @@ -207,20 +207,22 @@ class UserItem */ private static function checkShared(array $item, int $uid) { + // Only sheck on starting posts and reshare ("announce") activities, otherwise return if (($item['gravity'] != GRAVITY_PARENT) && ($item['verb'] != Activity::ANNOUNCE)) { return false; } - // Either the contact had posted something directly + // Check if the contact had posted or shared something directly if (DBA::exists('contact', ['id' => $item['contact-id'], 'notify_new_posts' => true])) { return true; } - if ($item['gravity'] != GRAVITY_PARENT) { + // Don't continue when the item had been an announce activity + if ($item['verb'] == Activity::ANNOUNCE) { return false; } - // Or the contact is a mentioned forum + // Check if the contact is a mentioned forum $tags = DBA::select('tag-view', ['url'], ['uri-id' => $item['uri-id'], 'type' => [Tag::MENTION, Tag::EXCLUSIVE_MENTION]]); while ($tag = DBA::fetch($tags)) { $condition = ['nurl' => Strings::normaliseLink($tag['url']), 'uid' => $uid, 'notify_new_posts' => true, 'contact-type' => Contact::TYPE_COMMUNITY];