3 if (!defined('GNUSOCIAL')) { exit(1); }
6 * Moderated notice stream, will take into account the scoping of
7 * notices as well as whether the profile is moderated somehow,
8 * such as by sandboxing or silencing.
10 * Inherits $this->scoped from ScopingNoticeStream as the Profile
11 * this stream is meant for. Can be null in case we're not logged in.
15 * @author Mikael Nordfeldth <mmn@hethane.se>
16 * @copyright 2016 Free Software Foundation, Inc.
17 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
18 * @link https://gnu.io/social
21 class ModeratedNoticeStream extends ScopingNoticeStream
23 protected function filter(Notice $notice)
25 if (!parent::filter($notice)) {
29 // If the notice author is sandboxed
30 if ($notice->getProfile()->isSandboxed()) {
31 if (!$this->scoped instanceof Profile) {
32 // Non-logged in users don't get to see posts by sandboxed users
34 } elseif (!$notice->getProfile()->sameAs($this->scoped) && !$this->scoped->hasRight(Right::REVIEWSPAM)) {
35 // And if we are logged in, deny if scoped user is neither the author nor has the right to review spam