]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Profile.php
Fix for failure/exception on subscription/subscriber lists when deleted profiles...
[quix0rs-gnu-social.git] / classes / Profile.php
index 972351a75b1a9adefe97b755cff8d21b217f6f84..bdac3ba453aa6e09dfd1e247aff7b98b30a1ac71 100644 (file)
@@ -354,7 +354,10 @@ class Profile extends Memcached_DataObject
         $profiles = array();
 
         while ($subs->fetch()) {
-            $profiles[] = Profile::staticGet($subs->subscribed);
+            $profile = Profile::staticGet($subs->subscribed);
+            if ($profile) {
+                $profiles[] = $profile;
+            }
         }
 
         return new ArrayWrapper($profiles);
@@ -369,7 +372,10 @@ class Profile extends Memcached_DataObject
         $profiles = array();
 
         while ($subs->fetch()) {
-            $profiles[] = Profile::staticGet($subs->subscriber);
+            $profile = Profile::staticGet($subs->subscriber);
+            if ($profile) {
+                $profiles[] = $profile;
+            }
         }
 
         return new ArrayWrapper($profiles);
@@ -850,6 +856,7 @@ class Profile extends Memcached_DataObject
             case Right::NEWNOTICE:
             case Right::NEWMESSAGE:
             case Right::SUBSCRIBE:
+            case Right::CREATEGROUP:
                 $result = !$this->isSilenced();
                 break;
             case Right::PUBLICNOTICE:
@@ -917,6 +924,31 @@ class Profile extends Memcached_DataObject
         return $xs->getString();
     }
 
+    /**
+     * Extra profile info for atom entries
+     *
+     * Clients use some extra profile info in the atom stream.
+     * This gives it to them.
+     *
+     * @param User $cur Current user
+     *
+     * @return array representation of <statusnet:profile_info> element
+     */
+
+    function profileInfo($cur)
+    {
+        $profileInfoAttr = array();
+
+        if ($cur != null) {
+            // Whether the current user is a subscribed to this profile
+            $profileInfoAttr['following'] = $cur->isSubscribed($this) ? 'true' : 'false';
+            // Whether the current user is has blocked this profile
+            $profileInfoAttr['blocking']  = $cur->hasBlocked($this) ? 'true' : 'false';
+        }
+
+        return array('statusnet:profile_info', $profileInfoAttr, null);
+    }
+
     /**
      * Returns an XML string fragment with profile information as an
      * Activity Streams <activity:actor> element.