store our own userprofile for checking impossibility

This commit is contained in:
Evan Prodromou 2012-03-21 16:23:52 -04:00
parent 6215ff8e07
commit 473f6ffac9
2 changed files with 7 additions and 3 deletions

View File

@ -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;
}

View File

@ -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;
}
}