]> git.mxchange.org Git - friendica.git/commitdiff
Reduce amount of notifications by communities
authorMichael <heluecht@pirati.ca>
Sat, 12 Mar 2022 04:20:19 +0000 (04:20 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 12 Mar 2022 04:20:19 +0000 (04:20 +0000)
src/Model/Post/UserNotification.php

index 806dfe26e5bdfa000a4bf0833aca1e6b1532198a..75fc0038068d459a2c19374d6dd2c87320fe1fda 100644 (file)
@@ -417,6 +417,14 @@ class UserNotification
                        return false;
                }
 
+               // Don't notify about reshares by communities of our own posts or each time someone comments
+               if (($item['verb'] == Activity::ANNOUNCE) && DBA::exists('contact', ['id' => $item['contact-id'], 'contact-type' => Contact::TYPE_COMMUNITY])) {
+                       $post = Post::selectFirst(['origin', 'gravity'], ['uri-id' => $item['thr-parent-id'], 'uid' => $uid]);
+                       if ($post['origin'] || ($post['gravity'] != GRAVITY_PARENT)) {
+                               return false;
+                       }
+               }
+
                // Check if the contact posted or shared something directly
                if (DBA::exists('contact', ['id' => $item['contact-id'], 'notify_new_posts' => true])) {
                        return true;