store our own userprofile for checking impossibility
This commit is contained in:
parent
38343f3877
commit
51229ca662
@ -47,6 +47,7 @@ if (!defined('STATUSNET')) {
|
|||||||
class GroupNoticeStream extends ScopingNoticeStream
|
class GroupNoticeStream extends ScopingNoticeStream
|
||||||
{
|
{
|
||||||
var $group;
|
var $group;
|
||||||
|
var $userProfile;
|
||||||
|
|
||||||
function __construct($group, $profile = -1)
|
function __construct($group, $profile = -1)
|
||||||
{
|
{
|
||||||
@ -54,6 +55,7 @@ class GroupNoticeStream extends ScopingNoticeStream
|
|||||||
$profile = Profile::current();
|
$profile = Profile::current();
|
||||||
}
|
}
|
||||||
$this->group = $group;
|
$this->group = $group;
|
||||||
|
$this->userProfile = $profile;
|
||||||
|
|
||||||
parent::__construct(new CachingNoticeStream(new RawGroupNoticeStream($group),
|
parent::__construct(new CachingNoticeStream(new RawGroupNoticeStream($group),
|
||||||
'user_group:notice_ids:' . $group->id),
|
'user_group:notice_ids:' . $group->id),
|
||||||
@ -81,7 +83,7 @@ class GroupNoticeStream extends ScopingNoticeStream
|
|||||||
function impossibleStream()
|
function impossibleStream()
|
||||||
{
|
{
|
||||||
if ($this->group->force_scope &&
|
if ($this->group->force_scope &&
|
||||||
(empty($this->profile) || !$this->profile->isMember($group))) {
|
(empty($this->userProfile) || !$this->userProfile->isMember($group))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ if (!defined('STATUSNET')) {
|
|||||||
class ProfileNoticeStream extends ScopingNoticeStream
|
class ProfileNoticeStream extends ScopingNoticeStream
|
||||||
{
|
{
|
||||||
var $streamProfile;
|
var $streamProfile;
|
||||||
|
var $userProfile;
|
||||||
|
|
||||||
function __construct($profile, $userProfile = -1)
|
function __construct($profile, $userProfile = -1)
|
||||||
{
|
{
|
||||||
@ -55,6 +56,7 @@ class ProfileNoticeStream extends ScopingNoticeStream
|
|||||||
$userProfile = Profile::current();
|
$userProfile = Profile::current();
|
||||||
}
|
}
|
||||||
$this->streamProfile = $profile;
|
$this->streamProfile = $profile;
|
||||||
|
$this->userProfile = $userProfile;
|
||||||
parent::__construct(new CachingNoticeStream(new RawProfileNoticeStream($profile),
|
parent::__construct(new CachingNoticeStream(new RawProfileNoticeStream($profile),
|
||||||
'profile:notice_ids:' . $profile->id),
|
'profile:notice_ids:' . $profile->id),
|
||||||
$userProfile);
|
$userProfile);
|
||||||
@ -85,7 +87,7 @@ class ProfileNoticeStream extends ScopingNoticeStream
|
|||||||
// If it's a private stream, and no user or not a subscriber
|
// If it's a private stream, and no user or not a subscriber
|
||||||
|
|
||||||
if (!empty($user) && $user->private_stream &&
|
if (!empty($user) && $user->private_stream &&
|
||||||
empty($this->profile) || !$this->profile->isSubscribed($this->streamProfile)) {
|
empty($this->userProfile) || !$this->userProfile->isSubscribed($this->streamProfile)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +95,7 @@ class ProfileNoticeStream extends ScopingNoticeStream
|
|||||||
|
|
||||||
if (common_config('notice', 'hidespam')) {
|
if (common_config('notice', 'hidespam')) {
|
||||||
if ($this->streamProfile->hasRole(Profile_role::SILENCED) &&
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user