]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
flush anonymous scope when a profile is silenced
authorEvan Prodromou <evan@status.net>
Thu, 22 Mar 2012 15:37:45 +0000 (11:37 -0400)
committerEvan Prodromou <evan@status.net>
Thu, 22 Mar 2012 15:37:45 +0000 (11:37 -0400)
classes/Profile.php

index 3b3e43025ba7189b0c1f3ce558bdd0cd0bc8d483..e07d37139b2bbcbe2de88f985a222e0c054c717a 100644 (file)
@@ -1139,11 +1139,27 @@ class Profile extends Managed_DataObject
     function silence()
     {
         $this->grantRole(Profile_role::SILENCED);
+        if (common_config('notice', 'hidespam')) {
+            $this->flushVisibility();
+        }
     }
 
     function unsilence()
     {
         $this->revokeRole(Profile_role::SILENCED);
+        if (common_config('notice', 'hidespam')) {
+            $this->flushVisibility();
+        }
+    }
+
+    function flushVisibility()
+    {
+        // Get all notices
+        $stream = new ProfileNoticeStream($this, $this);
+        $ids = $stream->getNoticeIds(0, CachingNoticeStream::CACHE_WINDOW);
+        foreach ($ids as $id) {
+            self::blow('notice:in-scope-for:%d:null', $id);
+        }
     }
 
     /**