]> git.mxchange.org Git - friendica.git/commitdiff
Don't create notifications for activities
authorMichael <heluecht@pirati.ca>
Wed, 12 Aug 2020 08:37:38 +0000 (08:37 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 12 Aug 2020 08:37:38 +0000 (08:37 +0000)
include/enotify.php
src/Model/UserItem.php

index 229ef33df7c12fc1d718210523f3007bc891dad3..dd80c20d0f6ba115e5d41bebe36a84bc03ab3907 100644 (file)
@@ -603,10 +603,6 @@ function check_item_notification($itemid, $uid, $notification_type) {
                return false;
        }
 
-       if (!in_array($item['gravity'], [GRAVITY_PARENT, GRAVITY_COMMENT]) && ($item['verb'] != Activity::ANNOUNCE)) {
-               return false;
-       }
-
        // Generate the notification array
        $params = [];
        $params['uid'] = $uid;
index 0b542dee9f3196a7bfdc37517384227771802309..1680dd2727219e52b0141561f26e10a9b11ff973 100644 (file)
@@ -58,6 +58,11 @@ class UserItem
                        return;
                }
 
+               // "Activity::FOLLOW" is an automated activity, so we ignore it here
+               if ($item['verb'] == Activity::FOLLOW) {
+                       return;
+               }
+
                // fetch all users in the thread
                $users = DBA::p("SELECT DISTINCT(`contact`.`uid`) FROM `item`
                        INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` != 0
@@ -102,32 +107,35 @@ class UserItem
                        return;
                }
 
-               if (self::checkImplicitMention($item, $profiles)) {
-                       $notification_type = $notification_type | self::NOTIF_IMPLICIT_TAGGED;
-               }
+               // Only create notifications for posts and comments, not for activities
+               if (in_array($item['gravity'], [GRAVITY_PARENT, GRAVITY_COMMENT])) {
+                       if (self::checkImplicitMention($item, $profiles)) {
+                               $notification_type = $notification_type | self::NOTIF_IMPLICIT_TAGGED;
+                       }
 
-               if (self::checkExplicitMention($item, $profiles)) {
-                       $notification_type = $notification_type | self::NOTIF_EXPLICIT_TAGGED;
-               }
+                       if (self::checkExplicitMention($item, $profiles)) {
+                               $notification_type = $notification_type | self::NOTIF_EXPLICIT_TAGGED;
+                       }
 
-               if (self::checkCommentedThread($item, $contacts)) {
-                       $notification_type = $notification_type | self::NOTIF_THREAD_COMMENT;
-               }
+                       if (self::checkCommentedThread($item, $contacts)) {
+                               $notification_type = $notification_type | self::NOTIF_THREAD_COMMENT;
+                       }
 
-               if (self::checkDirectComment($item, $contacts)) {
-                       $notification_type = $notification_type | self::NOTIF_DIRECT_COMMENT;
-               }
+                       if (self::checkDirectComment($item, $contacts)) {
+                               $notification_type = $notification_type | self::NOTIF_DIRECT_COMMENT;
+                       }
 
-               if (self::checkDirectCommentedThread($item, $contacts)) {
-                       $notification_type = $notification_type | self::NOTIF_DIRECT_THREAD_COMMENT;
-               }
+                       if (self::checkDirectCommentedThread($item, $contacts)) {
+                               $notification_type = $notification_type | self::NOTIF_DIRECT_THREAD_COMMENT;
+                       }
 
-               if (self::checkCommentedParticipation($item, $contacts)) {
-                       $notification_type = $notification_type | self::NOTIF_COMMENT_PARTICIPATION;
-               }
+                       if (self::checkCommentedParticipation($item, $contacts)) {
+                               $notification_type = $notification_type | self::NOTIF_COMMENT_PARTICIPATION;
+                       }
 
-               if (self::checkActivityParticipation($item, $contacts)) {
-                       $notification_type = $notification_type | self::NOTIF_ACTIVITY_PARTICIPATION;
+                       if (self::checkActivityParticipation($item, $contacts)) {
+                               $notification_type = $notification_type | self::NOTIF_ACTIVITY_PARTICIPATION;
+                       }
                }
 
                if (empty($notification_type)) {