Only show training buttons if you can train
This commit is contained in:
parent
717bb5f456
commit
cfef7af2ae
@ -168,22 +168,27 @@ class ActivitySpamPlugin extends Plugin
|
|||||||
|
|
||||||
function onEndShowNoticeOptionItems($nli)
|
function onEndShowNoticeOptionItems($nli)
|
||||||
{
|
{
|
||||||
$notice = $nli->getNotice();
|
$profile = Profile::current();
|
||||||
$out = $nli->getOut();
|
|
||||||
|
|
||||||
if (!empty($notice)) {
|
if (!empty($profile) && $profile->hasRight(self::TRAINSPAM)) {
|
||||||
|
|
||||||
$score = $this->getScore($notice);
|
$notice = $nli->getNotice();
|
||||||
|
$out = $nli->getOut();
|
||||||
|
|
||||||
if (empty($score)) {
|
if (!empty($notice)) {
|
||||||
$this->debug("No score for notice " . $notice->id);
|
|
||||||
// XXX: show a question-mark or something
|
$score = $this->getScore($notice);
|
||||||
} else if ($score->is_spam) {
|
|
||||||
$form = new TrainHamForm($out, $notice);
|
if (empty($score)) {
|
||||||
$form->show();
|
$this->debug("No score for notice " . $notice->id);
|
||||||
} else if (!$score->is_spam) {
|
// XXX: show a question-mark or something
|
||||||
$form = new TrainSpamForm($out, $notice);
|
} else if ($score->is_spam) {
|
||||||
$form->show();
|
$form = new TrainHamForm($out, $notice);
|
||||||
|
$form->show();
|
||||||
|
} else if (!$score->is_spam) {
|
||||||
|
$form = new TrainSpamForm($out, $notice);
|
||||||
|
$form->show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user