]> git.mxchange.org Git - friendica.git/commitdiff
Clarify the functionality
authorMichael <heluecht@pirati.ca>
Wed, 12 Aug 2020 13:54:19 +0000 (13:54 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 12 Aug 2020 13:54:19 +0000 (13:54 +0000)
src/Model/UserItem.php

index 1680dd2727219e52b0141561f26e10a9b11ff973..11446f6e81c3bd4299c233181060b47c960819ab 100644 (file)
@@ -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];