]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'master' of git@gitorious.org:statusnet/mainline into testing
authorBrion Vibber <brion@pobox.com>
Wed, 31 Mar 2010 19:47:42 +0000 (12:47 -0700)
committerBrion Vibber <brion@pobox.com>
Wed, 31 Mar 2010 19:47:42 +0000 (12:47 -0700)
classes/Profile.php
classes/User.php

index eded1ff71fcc84a2a4ec9c59dd16b9b73eafe703..5de35c191af66c78ab4ba1cbd284b3c376c25844 100644 (file)
@@ -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()
index 659ec9467b68b7a7cf880db07696d3e00e28acc4..2c256301c2f2d94a1cc36f4b079e9dd71b4352fc 100644 (file)
@@ -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');