]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/profilenoticestream.php
empty array wrappers
[quix0rs-gnu-social.git] / lib / profilenoticestream.php
index ba3387cf5ca7865036e667aa7d0e5db7971718fa..1fde1c6025e2408191284f5ae6b4be93387aa8e5 100644 (file)
@@ -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);
@@ -72,7 +74,7 @@ class ProfileNoticeStream extends ScopingNoticeStream
     function getNotices($offset, $limit, $sinceId = null, $maxId = null)
     {
         if ($this->impossibleStream()) {
-            return array();
+            return new ArrayWrapper(array());
         } else {
             return parent::getNotices($offset, $limit, $sinceId, $maxId);
         }
@@ -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;
             }
         }