We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 51229ca6 authored by Evan Prodromou's avatar Evan Prodromou

store our own userprofile for checking impossibility

parent 38343f38
......@@ -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;
}
......
......@@ -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;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment