Only hide spam if set
This commit is contained in:
parent
d016ce846e
commit
6f2f302004
@ -47,6 +47,7 @@ if (!defined('STATUSNET')) {
|
|||||||
class ActivitySpamPlugin extends Plugin
|
class ActivitySpamPlugin extends Plugin
|
||||||
{
|
{
|
||||||
public $server = null;
|
public $server = null;
|
||||||
|
public $hideSpam = false;
|
||||||
|
|
||||||
const REVIEWSPAM = 'ActivitySpamPlugin::REVIEWSPAM';
|
const REVIEWSPAM = 'ActivitySpamPlugin::REVIEWSPAM';
|
||||||
const TRAINSPAM = 'ActivitySpamPlugin::TRAINSPAM';
|
const TRAINSPAM = 'ActivitySpamPlugin::TRAINSPAM';
|
||||||
@ -62,6 +63,8 @@ class ActivitySpamPlugin extends Plugin
|
|||||||
common_config('activityspam', 'consumerkey'),
|
common_config('activityspam', 'consumerkey'),
|
||||||
common_config('activityspam', 'secret'));
|
common_config('activityspam', 'secret'));
|
||||||
|
|
||||||
|
$this->hideSpam = common_config('activityspam', 'hidespam');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,15 +284,17 @@ class ActivitySpamPlugin extends Plugin
|
|||||||
|
|
||||||
function onEndNoticeInScope($notice, $profile, &$bResult)
|
function onEndNoticeInScope($notice, $profile, &$bResult)
|
||||||
{
|
{
|
||||||
if ($bResult) {
|
if ($this->hideSpam) {
|
||||||
|
if ($bResult) {
|
||||||
|
|
||||||
$score = $this->getScore($notice);
|
$score = $this->getScore($notice);
|
||||||
|
|
||||||
if ($score->is_spam) {
|
if ($score->is_spam) {
|
||||||
if (empty($profile) ||
|
if (empty($profile) ||
|
||||||
($profile->id !== $notice->profile_id &&
|
($profile->id !== $notice->profile_id &&
|
||||||
!$profile->hasRight(self::REVIEWSPAM))) {
|
!$profile->hasRight(self::REVIEWSPAM))) {
|
||||||
$bResult = false;
|
$bResult = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user