Handle private streams better (failed to show profile before)

This commit is contained in:
Mikael Nordfeldth
2016-01-03 19:05:49 +01:00
parent 7df8a6b731
commit df0f9547b5
4 changed files with 52 additions and 9 deletions

View File

@@ -74,7 +74,7 @@ class ProfileNoticeStream extends ScopingNoticeStream
function getNotices($offset, $limit, $since_id=null, $max_id=null)
{
if ($this->impossibleStream()) {
return new ArrayWrapper(array());
throw new PrivateStreamException($this->streamProfile, $this->userProfile);
} else {
return parent::getNotices($offset, $limit, $since_id, $max_id);
}
@@ -82,12 +82,8 @@ class ProfileNoticeStream extends ScopingNoticeStream
function impossibleStream()
{
$user = User::getKV('id', $this->streamProfile->id);
// If it's a private stream, and no user or not a subscriber
if (!empty($user) && $user->private_stream &&
(empty($this->userProfile) || !$this->userProfile->isSubscribed($this->streamProfile))) {
if (!$this->streamProfile->readableBy($this->userProfile)) {
// cannot read because it's a private stream and either noone's logged in or they are not subscribers
return true;
}