diff options
author | Brion Vibber <brion@pobox.com> | 2010-11-15 15:32:57 -0800 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-11-15 15:32:57 -0800 |
commit | 0d0e51292d97e0b3a07cf1d12031df0b8f69823f (patch) | |
tree | 3ed9d20894079a5cc9a5a511b03b165c2183e34f /classes | |
parent | 227d4b688949a70c1dd3923628a101e1f0208e15 (diff) |
some User -> Profile cleanup to help in adapting the profile page action to show stuff for remote users. Subscriptions, groups, roles, etc are all on profiles now so go ahead and use em.
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 37d2c571f..b11cffc77 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -473,6 +473,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() |