]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Only hide spam if set
authorEvan Prodromou <evan@status.net>
Wed, 21 Mar 2012 01:37:35 +0000 (21:37 -0400)
committerEvan Prodromou <evan@status.net>
Wed, 21 Mar 2012 01:37:35 +0000 (21:37 -0400)
ActivitySpamPlugin.php

index b29401625920ed0e88eb9959d4658a595d6f54b6..6dde92759da5b079803fad22ce755e842e418b99 100644 (file)
@@ -47,6 +47,7 @@ if (!defined('STATUSNET')) {
 class ActivitySpamPlugin extends Plugin
 {
     public $server = null;
+    public $hideSpam = false;
 
     const REVIEWSPAM = 'ActivitySpamPlugin::REVIEWSPAM';
     const TRAINSPAM = 'ActivitySpamPlugin::TRAINSPAM';
@@ -62,6 +63,8 @@ class ActivitySpamPlugin extends Plugin
                                        common_config('activityspam', 'consumerkey'),
                                        common_config('activityspam', 'secret'));
 
+        $this->hideSpam = common_config('activityspam', 'hidespam');
+
         return true;
     }
 
@@ -281,15 +284,17 @@ class ActivitySpamPlugin extends Plugin
 
     function onEndNoticeInScope($notice, $profile, &$bResult)
     {
-        if ($bResult) {
+        if ($this->hideSpam) {
+            if ($bResult) {
 
-            $score = $this->getScore($notice);
+                $score = $this->getScore($notice);
 
-            if ($score->is_spam) {
-                if (empty($profile) ||
-                    ($profile->id !== $notice->profile_id &&
-                     !$profile->hasRight(self::REVIEWSPAM))) {
-                    $bResult = false;
+                if ($score->is_spam) {
+                    if (empty($profile) ||
+                        ($profile->id !== $notice->profile_id &&
+                         !$profile->hasRight(self::REVIEWSPAM))) {
+                        $bResult = false;
+                    }
                 }
             }
         }