]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/profilenoticestream.php
If there's no Happening, we can't use the RSVP.
[quix0rs-gnu-social.git] / lib / profilenoticestream.php
index f7154a52be9563ae3bc90551ee370838ae84771d..3c8de05855bb014eeade3f4f7708d137075be186 100644 (file)
@@ -62,7 +62,7 @@ class ProfileNoticeStream extends ScopingNoticeStream
                             $userProfile);
     }
 
-    function getNoticeIds($offset, $limit, $since_id, $max_id)
+    function getNoticeIds($offset, $limit, $since_id=null, $max_id=null)
     {
         if ($this->impossibleStream()) {
             return array();
@@ -71,23 +71,19 @@ 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 new ArrayWrapper(array());
+            throw new PrivateStreamException($this->streamProfile, $this->userProfile);
         } 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);
-
-        // 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;
         }
 
@@ -121,6 +117,7 @@ class RawProfileNoticeStream extends NoticeStream
 
     function __construct($profile)
     {
+        parent::__construct();
         $this->profile = $profile;
     }