forked from GNUsocial/gnu-social
		
	Get the score if needed on-demand
This commit is contained in:
		| @@ -173,7 +173,7 @@ class ActivitySpamPlugin extends Plugin | ||||
|  | ||||
|         if (!empty($notice)) { | ||||
|  | ||||
|             $score = Spam_score::staticGet('notice_id', $notice->id); | ||||
|             $score = $this->getScore($notice); | ||||
|  | ||||
|             if (empty($score)) { | ||||
|                 $this->debug("No score for notice " . $notice->id); | ||||
| @@ -243,4 +243,19 @@ class ActivitySpamPlugin extends Plugin | ||||
|                             _m('Test notices against the Activity Spam service.')); | ||||
|         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; | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user