]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/User.php
Moved functions into ActivityHandlerPlugin from MicroAppPlugin
[quix0rs-gnu-social.git] / classes / User.php
index d0eba7f75b4d8c21b816d8452f1b1a3a6ecd1726..c3ceb2646b166ca57a912c1d44aec2c31073a35a 100644 (file)
@@ -113,7 +113,7 @@ class User extends Managed_DataObject
         );
     }
 
-    protected $_profile = null;
+    protected $_profile = array();
 
     /**
      * @return Profile
@@ -122,14 +122,24 @@ class User extends Managed_DataObject
      */
     public function getProfile()
     {
-        if (!($this->_profile instanceof Profile)) {
-            $this->_profile = Profile::getKV('id', $this->id);
-            if (!($this->_profile instanceof Profile)) {
+        if (!isset($this->_profile[$this->id])) {
+            $profile = Profile::getKV('id', $this->id);
+            if (!$profile instanceof Profile) {
                 throw new UserNoProfileException($this);
             }
+            $this->_profile[$this->id] = $profile;
         }
+        return $this->_profile[$this->id];
+    }
+
+    public function getUri()
+    {
+        return $this->uri;
+    }
 
-        return $this->_profile;
+    public function getNickname()
+    {
+        return $this->getProfile()->getNickname();
     }
 
     function isSubscribed(Profile $other)
@@ -137,7 +147,7 @@ class User extends Managed_DataObject
         return $this->getProfile()->isSubscribed($other);
     }
 
-    function hasPendingSubscription($other)
+    function hasPendingSubscription(Profile $other)
     {
         return $this->getProfile()->hasPendingSubscription($other);
     }
@@ -430,12 +440,7 @@ class User extends Managed_DataObject
         }
     }
 
-    function hasFave($notice)
-    {
-        return $this->getProfile()->hasFave($notice);
-    }
-
-    function mutuallySubscribed($other)
+    function mutuallySubscribed(Profile $other)
     {
         return $this->getProfile()->mutuallySubscribed($other);
     }
@@ -469,16 +474,6 @@ class User extends Managed_DataObject
         return $this->getProfile()->getNotices($offset, $limit, $since_id, $before_id);
     }
 
-    function favoriteNotices($own=false, $offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $max_id=0)
-    {
-        return $this->getProfile()->favoriteNotices($own, $offset, $limit, $since_id, $max_id);
-    }
-
-    function blowFavesCache()
-    {
-        $this->getProfile()->blowFavesCache();
-    }
-
     function getSelfTags()
     {
         return Profile_tag::getTagsArray($this->id, $this->id, $this->id);
@@ -631,7 +626,7 @@ class User extends Managed_DataObject
             common_log(LOG_INFO, "User {$this->nickname} has no profile; continuing deletion.");
         }
 
-        $related = array('Fave',
+        $related = array(
                          'Confirm_address',
                          'Remember_me',
                          'Foreign_link',
@@ -971,18 +966,6 @@ class User extends Managed_DataObject
         return false;
     }
 
-    function conversationTree()
-    {
-        if (common_config('oldschool', 'enabled')) {
-            $osp = Old_school_prefs::getKV('user_id', $this->id);
-            if (!empty($osp)) {
-                return $osp->conversation_tree;
-            }
-        }
-
-        return false;
-    }
-
     function streamNicknames()
     {
         if (common_config('oldschool', 'enabled')) {