forked from GNUsocial/gnu-social
Get the score if needed on-demand
This commit is contained in:
parent
6a49e26321
commit
717bb5f456
@ -173,7 +173,7 @@ class ActivitySpamPlugin extends Plugin
|
|||||||
|
|
||||||
if (!empty($notice)) {
|
if (!empty($notice)) {
|
||||||
|
|
||||||
$score = Spam_score::staticGet('notice_id', $notice->id);
|
$score = $this->getScore($notice);
|
||||||
|
|
||||||
if (empty($score)) {
|
if (empty($score)) {
|
||||||
$this->debug("No score for notice " . $notice->id);
|
$this->debug("No score for notice " . $notice->id);
|
||||||
@ -243,4 +243,19 @@ class ActivitySpamPlugin extends Plugin
|
|||||||
_m('Test notices against the Activity Spam service.'));
|
_m('Test notices against the Activity Spam service.'));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getScore($notice)
|
||||||
|
{
|
||||||
|
$score = Spam_score::staticGet('notice_id', $notice->id);
|
||||||
|
|
||||||
|
if (!empty($score)) {
|
||||||
|
return $score;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->filter->test($notice);
|
||||||
|
|
||||||
|
$score = Spam_score::saveNew($notice, $result);
|
||||||
|
|
||||||
|
return $score;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user