Merge branch 'master' of git@gitorious.org:statusnet/mainline into testing

This commit is contained in:
Brion Vibber 2010-03-31 12:47:42 -07:00
commit 3ed88938b9
2 changed files with 35 additions and 11 deletions

View File

@ -577,11 +577,41 @@ class Profile extends Memcached_DataObject
{ {
$sub = new Subscription(); $sub = new Subscription();
$sub->subscriber = $this->id; $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 = new Subscription();
$subd->subscribed = $this->id; $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() function _deleteMessages()

View File

@ -525,8 +525,8 @@ class User extends Memcached_DataObject
common_log(LOG_WARNING, common_log(LOG_WARNING,
sprintf( sprintf(
"Profile ID %d (%s) tried to block his or herself.", "Profile ID %d (%s) tried to block his or herself.",
$profile->id, $this->id,
$profile->nickname $this->nickname
) )
); );
return false; return false;
@ -548,13 +548,7 @@ class User extends Memcached_DataObject
return false; return false;
} }
// Cancel their subscription, if it exists Subscription::cancel($other, $this->getProfile());
$otherUser = User::staticGet('id', $other->id);
if (!empty($otherUser)) {
subs_unsubscribe_to($otherUser, $this->getProfile());
}
$block->query('COMMIT'); $block->query('COMMIT');