X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fscopingnoticestream.php;h=c1651d5a30b1c347c33803091ddf441d5b65f1b3;hb=996345088e8d57cf39fa38129ab50ff02918a275;hp=a7ecbcd56ba8c34f44251317e28a93309edce8a6;hpb=36b331d469b6dcd1101783f21265f7be624bc58f;p=quix0rs-gnu-social.git diff --git a/lib/scopingnoticestream.php b/lib/scopingnoticestream.php index a7ecbcd56b..c1651d5a30 100644 --- a/lib/scopingnoticestream.php +++ b/lib/scopingnoticestream.php @@ -49,16 +49,15 @@ class ScopingNoticeStream extends FilteringNoticeStream { protected $profile; - function __construct($upstream, $profile = null) + function __construct($upstream, $profile = -1) { parent::__construct($upstream); - if (empty($profile)) { - $user = common_current_user(); - if (!empty($user)) { - $profile = $user->getProfile(); - } + // Invalid but not null + if (is_int($profile) && $profile == -1) { + $profile = Profile::current(); } + $this->profile = $profile; } @@ -74,5 +73,25 @@ class ScopingNoticeStream extends FilteringNoticeStream { return $notice->inScope($this->profile); } - + + 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)); + } + } }