]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Profile.php
Handle private streams better (failed to show profile before)
[quix0rs-gnu-social.git] / classes / Profile.php
index a45511fe54b60a1a02d87258cb61656e2f9d1010..1c8dbcc2525e14b45c7de055fde0844535f9dfb2 100644 (file)
@@ -761,6 +761,17 @@ class Profile extends Managed_DataObject
         return Subscription::exists($this, $other);
     }
 
+    function readableBy(Profile $other=null)
+    {
+        // If it's not a private stream, it's readable by anyone
+        if (!$this->isPrivateStream()) {
+            return true;
+        }
+
+        // If it's a private stream, $other must be a subscriber to $this
+        return is_null($other) ? false : $other->isSubscribed($this);
+    }
+
     /**
      * Check if a pending subscription request is outstanding for this...
      *