summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-03-31 12:48:24 -0700
committerBrion Vibber <brion@pobox.com>2010-03-31 12:48:24 -0700
commitdf9eb4164aec6d63869dee7bfd5cfddf6d831618 (patch)
treec078b097143772da34a6660039e79e470f86325a /classes
parent89bb05311685d1bab404300e600f61deb954e18c (diff)
parent3ed88938b95804ecadc62ed3a5f61a0863e2ff78 (diff)
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'classes')
-rw-r--r--classes/Profile.php34
-rw-r--r--classes/User.php12
2 files changed, 35 insertions, 11 deletions
diff --git a/classes/Profile.php b/classes/Profile.php
index eded1ff71..5de35c191 100644
--- a/classes/Profile.php
+++ b/classes/Profile.php
@@ -577,11 +577,41 @@ class Profile extends Memcached_DataObject
{
$sub = new Subscription();
$sub->subscriber = $this->id;
- $sub->delete();
+
+ $sub->find();
+
+ while ($sub->fetch()) {
+ $other = Profile::staticGet('id', $sub->subscribed);
+ if (empty($other)) {
+ continue;
+ }
+ if ($other->id == $this->id) {
+ continue;
+ }
+ Subscription::cancel($this, $other);
+ }
$subd = new Subscription();
$subd->subscribed = $this->id;
- $subd->delete();
+ $subd->find();
+
+ while ($subd->fetch()) {
+ $other = Profile::staticGet('id', $subd->subscriber);
+ if (empty($other)) {
+ continue;
+ }
+ if ($other->id == $this->id) {
+ continue;
+ }
+ Subscription::cancel($other, $this);
+ }
+
+ $self = new Subscription();
+
+ $self->subscriber = $this->id;
+ $self->subscribed = $this->id;
+
+ $self->delete();
}
function _deleteMessages()
diff --git a/classes/User.php b/classes/User.php
index 659ec9467..2c256301c 100644
--- a/classes/User.php
+++ b/classes/User.php
@@ -525,8 +525,8 @@ class User extends Memcached_DataObject
common_log(LOG_WARNING,
sprintf(
"Profile ID %d (%s) tried to block his or herself.",
- $profile->id,
- $profile->nickname
+ $this->id,
+ $this->nickname
)
);
return false;
@@ -548,13 +548,7 @@ class User extends Memcached_DataObject
return false;
}
- // Cancel their subscription, if it exists
-
- $otherUser = User::staticGet('id', $other->id);
-
- if (!empty($otherUser)) {
- subs_unsubscribe_to($otherUser, $this->getProfile());
- }
+ Subscription::cancel($other, $this->getProfile());
$block->query('COMMIT');