diff options
author | Brion Vibber <brion@pobox.com> | 2010-03-18 14:26:32 -0700 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-03-18 14:26:32 -0700 |
commit | cac9d23498808a60dfb890aef437606e98106a6d (patch) | |
tree | de1b7561874c07016bf9e09a1f09a059a29408f5 /classes/User.php | |
parent | f1b3d84b7d55cc7c466982a95815ba1ddf130418 (diff) |
Fix for xmpp/sms notification options appearing to be disabled on new subscriptions.
Base problem is that our caching-on-insert interferes with relying on column default values; the cached object is missing those fields, so they appear to be empty (null) when the object is retrieved from cache.
Now explicitly setting them when inserting subscriptions, and cleaned up some code that had alternate code paths.
May also have made auto-subscription work for remote OStatus subscribers, but can't test until magic sigs are working again.
Diffstat (limited to 'classes/User.php')
-rw-r--r-- | classes/User.php | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/classes/User.php b/classes/User.php index 16c256535..8ad2ec63d 100644 --- a/classes/User.php +++ b/classes/User.php @@ -153,19 +153,12 @@ class User extends Memcached_DataObject return Sms_carrier::staticGet('id', $this->carrier); } + /** + * @deprecated use Subscription::start($sub, $other); + */ function subscribeTo($other) { - $sub = new Subscription(); - $sub->subscriber = $this->id; - $sub->subscribed = $other->id; - - $sub->created = common_sql_now(); // current time - - if (!$sub->insert()) { - return false; - } - - return true; + return Subscription::start($this->getProfile(), $other); } function hasBlocked($other) @@ -346,17 +339,7 @@ class User extends Memcached_DataObject common_log(LOG_WARNING, sprintf("Default user %s does not exist.", $defnick), __FILE__); } else { - $defsub = new Subscription(); - $defsub->subscriber = $user->id; - $defsub->subscribed = $defuser->id; - $defsub->created = $user->created; - - $result = $defsub->insert(); - - if (!$result) { - common_log_db_error($defsub, 'INSERT', __FILE__); - return false; - } + Subscription::start($user, $defuser); } } |