]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/User.php
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing
[quix0rs-gnu-social.git] / classes / User.php
index 4013fbc832d4388ac33a51b06c5ba09d7970d24b..10b1f486513a4bb5b38ecc5c48d4f8e371c5b684 100644 (file)
@@ -80,11 +80,7 @@ class User extends Memcached_DataObject
 
     function isSubscribed($other)
     {
-        assert(!is_null($other));
-        // XXX: cache results of this query
-        $sub = Subscription::pkeyGet(array('subscriber' => $this->id,
-                                           'subscribed' => $other->id));
-        return (is_null($sub)) ? false : true;
+        return Subscription::exists($this->getProfile(), $other);
     }
 
     // 'update' won't write key columns, so we have to do it ourselves.
@@ -167,17 +163,8 @@ class User extends Memcached_DataObject
 
     function hasBlocked($other)
     {
-
-        $block = Profile_block::get($this->id, $other->id);
-
-        if (is_null($block)) {
-            $result = false;
-        } else {
-            $result = true;
-            $block->free();
-        }
-
-        return $result;
+        $profile = $this->getProfile();
+        return $profile->hasBlocked($other);
     }
 
     /**
@@ -250,10 +237,6 @@ class User extends Memcached_DataObject
 
         $user->nickname = $nickname;
 
-        if (!empty($password)) { // may not have a password for OpenID users
-            $user->password = common_munge_password($password, $id);
-        }
-
         // Users who respond to invite email have proven their ownership of that address
 
         if (!empty($code)) {
@@ -286,6 +269,9 @@ class User extends Memcached_DataObject
 
             $user->id = $id;
             $user->uri = common_user_uri($user);
+            if (!empty($password)) { // may not have a password for OpenID users
+                $user->password = common_munge_password($password, $id);
+            }
 
             $result = $user->insert();
 
@@ -503,28 +489,22 @@ class User extends Memcached_DataObject
 
     function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
     {
-        $ids = Inbox::stream($this->id, $offset, $limit, $since_id, $before_id, $since, false);
-        return Notice::getStreamByIds($ids);
+        return Inbox::streamNotices($this->id, $offset, $limit, $since_id, $before_id, $since, false);
     }
 
     function noticeInbox($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
     {
-        $ids = Inbox::stream($this->id, $offset, $limit, $since_id, $before_id, $since, true);
-        return Notice::getStreamByIds($ids);
+        return Inbox::streamNotices($this->id, $offset, $limit, $since_id, $before_id, $since, true);
     }
 
     function friendsTimeline($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
     {
-        $ids = Inbox::stream($this->id, $offset, $limit, $since_id, $before_id, $since, false);
-
-        return Notice::getStreamByIds($ids);
+        return Inbox::streamNotices($this->id, $offset, $limit, $since_id, $before_id, $since, false);
     }
 
     function ownFriendsTimeline($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
     {
-        $ids = Inbox::stream($this->id, $offset, $limit, $since_id, $before_id, $since, true);
-
-        return Notice::getStreamByIds($ids);
+        return Inbox::streamNotices($this->id, $offset, $limit, $since_id, $before_id, $since, true);
     }
 
     function blowFavesCache()