the repeated notice can be from a sandboxed user too
This commit is contained in:
parent
a9bdf761e8
commit
7d4658643d
@ -25,18 +25,40 @@ class ModeratedNoticeStream extends ScopingNoticeStream
|
|||||||
if (!parent::filter($notice)) {
|
if (!parent::filter($notice)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the notice author is sandboxed
|
if(self::include_or_not($notice) === false) {
|
||||||
if ($notice->getProfile()->isSandboxed()) {
|
return false;
|
||||||
if (!$this->scoped instanceof Profile) {
|
}
|
||||||
// Non-logged in users don't get to see posts by sandboxed users
|
|
||||||
return false;
|
// If this is a repeat the repeated notice is moderated
|
||||||
} elseif (!$notice->getProfile()->sameAs($this->scoped) && !$this->scoped->hasRight(Right::REVIEWSPAM)) {
|
if($notice->isRepeat()) {
|
||||||
// And if we are logged in, deny if scoped user is neither the author nor has the right to review spam
|
try {
|
||||||
|
$repeated_notice = Notice::getById($notice->repeat_of);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
// if we can't get the repeated notice by id, something is seriously wrong with it, so don't include it
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if(self::include_or_not($repeated_notice) === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function include_or_not(Notice $notice)
|
||||||
|
{
|
||||||
|
$profile = $notice->getProfile();
|
||||||
|
|
||||||
|
if ($profile->isSandboxed()) {
|
||||||
|
if (!$this->scoped instanceof Profile) {
|
||||||
|
// Non-logged in users don't get to see posts by sandboxed users
|
||||||
|
return false;
|
||||||
|
} elseif (!$profile->sameAs($this->scoped) && !$this->scoped->hasRight(Right::REVIEWSPAM)) {
|
||||||
|
// And if we are logged in, deny if scoped user is neither the author nor has the right to review spam
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user