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

Commit 38343f38 authored by Evan Prodromou's avatar Evan Prodromou

Don't try to find groupnoticestream if impossible

parent 710eb8e8
......@@ -46,15 +46,47 @@ if (!defined('STATUSNET')) {
*/
class GroupNoticeStream extends ScopingNoticeStream
{
var $group;
function __construct($group, $profile = -1)
{
if (is_int($profile) && $profile == -1) {
$profile = Profile::current();
}
$this->group = $group;
parent::__construct(new CachingNoticeStream(new RawGroupNoticeStream($group),
'user_group:notice_ids:' . $group->id),
$profile);
}
function getNoticeIds($offset, $limit, $since_id, $max_id)
{
if ($this->impossibleStream()) {
return array();
} else {
return parent::getNoticeIds($offset, $limit, $since_id, $max_id);
}
}
function getNotices($offset, $limit, $sinceId = null, $maxId = null)
{
if ($this->impossibleStream()) {
return array();
} else {
return parent::getNotices($offset, $limit, $sinceId, $maxId);
}
}
function impossibleStream()
{
if ($this->group->force_scope &&
(empty($this->profile) || !$this->profile->isMember($group))) {
return true;
}
return false;
}
}
/**
......
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