From: Evan Prodromou Date: Mon, 19 Mar 2012 14:30:54 +0000 (-0400) Subject: Only show training buttons if you can train X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=cfef7af2ae69322eb65394dbe493d242bb632903;p=quix0rs-gnu-social.git Only show training buttons if you can train --- diff --git a/ActivitySpamPlugin.php b/ActivitySpamPlugin.php index 35e12dc33d..5e13d3610f 100644 --- a/ActivitySpamPlugin.php +++ b/ActivitySpamPlugin.php @@ -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(); + } } }