X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fprofilenoticestream.php;h=1fa795d32090a55866c49f9221757ab7c089fdcb;hb=1ee79dc3791162f7ef9b92befaef597328266ce1;hp=ba3387cf5ca7865036e667aa7d0e5db7971718fa;hpb=f807bd1b30ebc84855e593283bdc3569028b2ddf;p=quix0rs-gnu-social.git diff --git a/lib/profilenoticestream.php b/lib/profilenoticestream.php index ba3387cf5c..1fa795d320 100644 --- a/lib/profilenoticestream.php +++ b/lib/profilenoticestream.php @@ -48,6 +48,7 @@ if (!defined('STATUSNET')) { class ProfileNoticeStream extends ScopingNoticeStream { var $streamProfile; + var $userProfile; function __construct($profile, $userProfile = -1) { @@ -55,12 +56,13 @@ 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); } - function getNoticeIds($offset, $limit, $since_id, $max_id) + function getNoticeIds($offset, $limit, $since_id=null, $max_id=null) { if ($this->impossibleStream()) { return array(); @@ -69,23 +71,23 @@ class ProfileNoticeStream extends ScopingNoticeStream } } - function getNotices($offset, $limit, $sinceId = null, $maxId = null) + function getNotices($offset, $limit, $since_id=null, $max_id=null) { if ($this->impossibleStream()) { - return array(); + return new ArrayWrapper(array()); } else { - return parent::getNotices($offset, $limit, $sinceId, $maxId); + return parent::getNotices($offset, $limit, $since_id, $max_id); } } function impossibleStream() { - $user = User::staticGet('id', $this->streamProfile->id); + $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->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->id !== $this->streamProfile->id) && !$this->userProfile->hasRight(Right::REVIEWSPAM)))) { return true; } } @@ -119,6 +121,7 @@ class RawProfileNoticeStream extends NoticeStream function __construct($profile) { + parent::__construct(); $this->profile = $profile; }