]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Post/UserNotification.php
Don't cache local avatars
[friendica.git] / src / Model / Post / UserNotification.php
index d7c72d8994f3e67143bd037be094c5857dad3d60..ad7b9c4904b4cb616175e9562b3baedfb9d61d1d 100644 (file)
@@ -257,8 +257,12 @@ class UserNotification
                        }
                }
 
+               if (empty($notification_type)) {
+                       return;
+               }
+
                // Only create notifications for posts and comments, not for activities
-               if (empty($notification_type) || !in_array($item['gravity'], [GRAVITY_PARENT, GRAVITY_COMMENT])) {
+               if (($item['gravity'] == GRAVITY_ACTIVITY) && ($item['verb'] != Activity::ANNOUNCE)) {
                        return;
                }
 
@@ -280,7 +284,7 @@ class UserNotification
         */
        private static function insertNotificationByItem(int $type, int $uid, array $item): void
        {
-               if (($item['gravity'] == GRAVITY_ACTIVITY) &&
+               if (($item['verb'] != Activity::ANNOUNCE) && ($item['gravity'] == GRAVITY_ACTIVITY) &&
                        !in_array($type, [self::TYPE_DIRECT_COMMENT, self::TYPE_DIRECT_THREAD_COMMENT])) {
                        // Activities are only stored when performed on the user's post or comment
                        return;
@@ -402,21 +406,6 @@ class UserNotification
                        return true;
                }
 
-               // The following check doesn't make sense on activities, so quit here
-               if ($item['verb'] == Activity::ANNOUNCE) {
-                       return false;
-               }
-
-               // 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];
-                       if (DBA::exists('contact', $condition)) {
-                               return true;
-                       }
-               }
-               DBA::close($tags);
-
                return false;
        }