From: Evan Prodromou Date: Wed, 21 Mar 2012 20:23:52 +0000 (-0400) Subject: store our own userprofile for checking impossibility X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=473f6ffac90e8f56f502940e1322248d98266949;p=quix0rs-gnu-social.git store our own userprofile for checking impossibility --- diff --git a/lib/groupnoticestream.php b/lib/groupnoticestream.php index 849dfeaaf5..c75d621419 100644 --- a/lib/groupnoticestream.php +++ b/lib/groupnoticestream.php @@ -47,6 +47,7 @@ if (!defined('STATUSNET')) { class GroupNoticeStream extends ScopingNoticeStream { var $group; + var $userProfile; function __construct($group, $profile = -1) { @@ -54,6 +55,7 @@ class GroupNoticeStream extends ScopingNoticeStream $profile = Profile::current(); } $this->group = $group; + $this->userProfile = $profile; parent::__construct(new CachingNoticeStream(new RawGroupNoticeStream($group), 'user_group:notice_ids:' . $group->id), @@ -81,7 +83,7 @@ class GroupNoticeStream extends ScopingNoticeStream function impossibleStream() { if ($this->group->force_scope && - (empty($this->profile) || !$this->profile->isMember($group))) { + (empty($this->userProfile) || !$this->userProfile->isMember($group))) { return true; } diff --git a/lib/profilenoticestream.php b/lib/profilenoticestream.php index ba3387cf5c..af59b0cc99 100644 --- a/lib/profilenoticestream.php +++ b/lib/profilenoticestream.php @@ -48,6 +48,7 @@ if (!defined('STATUSNET')) { class ProfileNoticeStream extends ScopingNoticeStream { var $streamProfile; + var $userProfile; function __construct($profile, $userProfile = -1) { @@ -55,6 +56,7 @@ class ProfileNoticeStream extends ScopingNoticeStream $userProfile = Profile::current(); } $this->streamProfile = $profile; + $this->userProfile = $userProfile; parent::__construct(new CachingNoticeStream(new RawProfileNoticeStream($profile), 'profile:notice_ids:' . $profile->id), $userProfile); @@ -85,7 +87,7 @@ class ProfileNoticeStream extends ScopingNoticeStream // If it's a private stream, and no user or not a subscriber if (!empty($user) && $user->private_stream && - empty($this->profile) || !$this->profile->isSubscribed($this->streamProfile)) { + empty($this->userProfile) || !$this->userProfile->isSubscribed($this->streamProfile)) { return true; } @@ -93,7 +95,7 @@ class ProfileNoticeStream extends ScopingNoticeStream if (common_config('notice', 'hidespam')) { if ($this->streamProfile->hasRole(Profile_role::SILENCED) && - (empty($this->profile) || !$this->profile->hasRole(Profile_role::MODERATOR))) { + (empty($this->userProfile) || !$this->userProfile->hasRole(Profile_role::MODERATOR))) { return true; } }