. * * @category Stream * @package StatusNet * @author Evan Prodromou * @copyright 2011 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ if (!defined('GNUSOCIAL')) { exit(1); } /** * Class comment * * @category Stream * @package StatusNet * @author Evan Prodromou * @copyright 2011 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ class ScopingNoticeStream extends FilteringNoticeStream { protected $profile; function __construct(NoticeStream $upstream, Profile $scoped=null) { parent::__construct($upstream); $this->profile = $scoped; // legacy $this->scoped = $scoped; } /** * Only return notices where the profile is in scope * * @param Notice $notice The notice to check * * @return boolean whether to include the notice */ protected function filter(Notice $notice) { return $notice->inScope($this->scoped); } function prefill($notices) { // XXX: this should probably only be in the scoping one. Notice::fillGroups($notices); Notice::fillReplies($notices); if (common_config('notice', 'hidespam')) { $profiles = Notice::getProfiles($notices); foreach ($profiles as $profile) { $pids[] = $profile->id; } Profile_role::pivotGet('profile_id', $pids, array('role' => Profile_role::SILENCED)); } } }