]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Only show training buttons if you can train
authorEvan Prodromou <evan@status.net>
Mon, 19 Mar 2012 14:30:54 +0000 (10:30 -0400)
committerEvan Prodromou <evan@status.net>
Mon, 19 Mar 2012 14:30:54 +0000 (10:30 -0400)
ActivitySpamPlugin.php

index 35e12dc33de5987efcb04a7d2444681eb759326f..5e13d3610f320440aa27e141a79e594b08f46b2a 100644 (file)
@@ -168,22 +168,27 @@ class ActivitySpamPlugin extends Plugin
 
     function onEndShowNoticeOptionItems($nli)
     {
-        $notice = $nli->getNotice();
-        $out = $nli->getOut();
-
-        if (!empty($notice)) {
-
-            $score = $this->getScore($notice);
-
-            if (empty($score)) {
-                $this->debug("No score for notice " . $notice->id);
-                // XXX: show a question-mark or something
-            } else if ($score->is_spam) {
-                $form = new TrainHamForm($out, $notice);
-                $form->show();
-            } else if (!$score->is_spam) {
-                $form = new TrainSpamForm($out, $notice);
-                $form->show();
+        $profile = Profile::current();
+
+        if (!empty($profile) && $profile->hasRight(self::TRAINSPAM)) {
+
+            $notice = $nli->getNotice();
+            $out = $nli->getOut();
+
+            if (!empty($notice)) {
+
+                $score = $this->getScore($notice);
+
+                if (empty($score)) {
+                    $this->debug("No score for notice " . $notice->id);
+                    // XXX: show a question-mark or something
+                } else if ($score->is_spam) {
+                    $form = new TrainHamForm($out, $notice);
+                    $form->show();
+                } else if (!$score->is_spam) {
+                    $form = new TrainSpamForm($out, $notice);
+                    $form->show();
+                }
             }
         }