diff options
author | Evan Prodromou <evan@status.net> | 2010-03-18 15:21:43 -0500 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-03-18 15:21:43 -0500 |
commit | dbd44e51a2a9c5c63a6211002e5dd3b14483fb60 (patch) | |
tree | 56344401c6a541eca0b45ec01201faa9c52ce3f9 /classes | |
parent | 2ccd5187ccd509f3f579629186a7087720e5f94a (diff) | |
parent | f1b3d84b7d55cc7c466982a95815ba1ddf130418 (diff) |
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing
Diffstat (limited to 'classes')
-rw-r--r-- | classes/Foreign_user.php | 1 | ||||
-rw-r--r-- | classes/Subscription.php | 4 | ||||
-rw-r--r-- | classes/User.php | 28 |
3 files changed, 12 insertions, 21 deletions
diff --git a/classes/Foreign_user.php b/classes/Foreign_user.php index 8b3e03dfb..0dd94ffb9 100644 --- a/classes/Foreign_user.php +++ b/classes/Foreign_user.php @@ -41,6 +41,7 @@ class Foreign_user extends Memcached_DataObject function updateKeys(&$orig) { + $this->_connect(); $parts = array(); foreach (array('id', 'service', 'uri', 'nickname') as $k) { if (strcmp($this->$k, $orig->$k) != 0) { diff --git a/classes/Subscription.php b/classes/Subscription.php index 9cef2df1a..5ac95f922 100644 --- a/classes/Subscription.php +++ b/classes/Subscription.php @@ -105,8 +105,8 @@ class Subscription extends Memcached_DataObject $auto = new Subscription(); - $auto->subscriber = $subscriber->id; - $auto->subscribed = $other->id; + $auto->subscriber = $other->id; + $auto->subscribed = $subscriber->id; $auto->created = common_sql_now(); $result = $auto->insert(); diff --git a/classes/User.php b/classes/User.php index 77091fad5..16c256535 100644 --- a/classes/User.php +++ b/classes/User.php @@ -75,7 +75,11 @@ class User extends Memcached_DataObject function getProfile() { - return Profile::staticGet('id', $this->id); + $profile = Profile::staticGet('id', $this->id); + if (empty($profile)) { + throw new UserNoProfileException($this); + } + return $profile; } function isSubscribed($other) @@ -87,6 +91,7 @@ class User extends Memcached_DataObject function updateKeys(&$orig) { + $this->_connect(); $parts = array(); foreach (array('nickname', 'email', 'jabber', 'incomingemail', 'sms', 'carrier', 'smsemail', 'language', 'timezone') as $k) { if (strcmp($this->$k, $orig->$k) != 0) { @@ -140,9 +145,6 @@ class User extends Memcached_DataObject function getCurrentNotice() { $profile = $this->getProfile(); - if (!$profile) { - return null; - } return $profile->getCurrentNotice(); } @@ -470,21 +472,13 @@ class User extends Memcached_DataObject function getTaggedNotices($tag, $offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0) { $profile = $this->getProfile(); - if (!$profile) { - return null; - } else { - return $profile->getTaggedNotices($tag, $offset, $limit, $since_id, $before_id); - } + return $profile->getTaggedNotices($tag, $offset, $limit, $since_id, $before_id); } function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0) { $profile = $this->getProfile(); - if (!$profile) { - return null; - } else { - return $profile->getNotices($offset, $limit, $since_id, $before_id); - } + return $profile->getNotices($offset, $limit, $since_id, $before_id); } function favoriteNotices($offset=0, $limit=NOTICES_PER_PAGE, $own=false) @@ -625,14 +619,12 @@ class User extends Memcached_DataObject function getSubscriptions($offset=0, $limit=null) { $profile = $this->getProfile(); - assert(!empty($profile)); return $profile->getSubscriptions($offset, $limit); } function getSubscribers($offset=0, $limit=null) { $profile = $this->getProfile(); - assert(!empty($profile)); return $profile->getSubscribers($offset, $limit); } @@ -696,9 +688,7 @@ class User extends Memcached_DataObject function delete() { $profile = $this->getProfile(); - if ($profile) { - $profile->delete(); - } + $profile->delete(); $related = array('Fave', 'Confirm_address', |