diff options
author | Brion Vibber <brion@pobox.com> | 2010-11-15 17:36:48 -0800 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-11-15 17:36:48 -0800 |
commit | e4eb3b3dfd6b9b5cbd1b34d7fc4738b6fd19ee99 (patch) | |
tree | a4cd3b7d7c8530fa5a9c822ebc2f97ac8cf6b64a /classes | |
parent | 62dfdb34a613f61e8f546b60468e1a73ee18d7e0 (diff) | |
parent | 25170f272ca853c585531894d282c7545f00bf16 (diff) |
Merge branch 'master' of gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'classes')
-rw-r--r-- | classes/Profile.php | 23 | ||||
-rw-r--r-- | classes/User.php | 7 |
2 files changed, 27 insertions, 3 deletions
diff --git a/classes/Profile.php b/classes/Profile.php index d580e1235..3ea95ab01 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -494,6 +494,29 @@ class Profile extends Memcached_DataObject return $cnt; } + /** + * Is this profile subscribed to another profile? + * + * @param Profile $other + * @return boolean + */ + function isSubscribed($other) + { + return Subscription::exists($this, $other); + } + + /** + * Are these two profiles subscribed to each other? + * + * @param Profile $other + * @return boolean + */ + function mutuallySubscribed($other) + { + return $this->isSubscribed($other) && + $other->isSubscribed($this); + } + function hasFave($notice) { $cache = common_memcache(); diff --git a/classes/User.php b/classes/User.php index 7345dc7f9..964bc3e7f 100644 --- a/classes/User.php +++ b/classes/User.php @@ -84,7 +84,8 @@ class User extends Memcached_DataObject function isSubscribed($other) { - return Subscription::exists($this->getProfile(), $other); + $profile = $this->getProfile(); + return $profile->isSubscribed($other); } // 'update' won't write key columns, so we have to do it ourselves. @@ -418,8 +419,8 @@ class User extends Memcached_DataObject function mutuallySubscribed($other) { - return $this->isSubscribed($other) && - $other->isSubscribed($this); + $profile = $this->getProfile(); + return $profile->mutuallySubscribed($other); } function mutuallySubscribedUsers() |