]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/deleteuser.php
Add repeat info to statusnet:notice_info Atom element
[quix0rs-gnu-social.git] / actions / deleteuser.php
index c4f84fad2d82d03711b703891bd1045c8862b8ff..c0a8b20e2c535defab0941e6941ca881650c0d0f 100644 (file)
@@ -64,14 +64,14 @@ class DeleteuserAction extends ProfileFormAction
         assert(!empty($cur)); // checked by parent
 
         if (!$cur->hasRight(Right::DELETEUSER)) {
-            $this->clientError(_("You cannot delete users."));
+            $this->clientError(_('You cannot delete users.'));
             return false;
         }
 
         $this->user = User::staticGet('id', $this->profile->id);
 
         if (empty($this->user)) {
-            $this->clientError(_("You can only delete local users."));
+            $this->clientError(_('You can only delete local users.'));
             return false;
         }
 
@@ -92,10 +92,10 @@ class DeleteuserAction extends ProfileFormAction
     {
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             if ($this->arg('no')) {
-                $this->returnToArgs();
+                $this->returnToPrevious();
             } elseif ($this->arg('yes')) {
                 $this->handlePost();
-                $this->returnToArgs();
+                $this->returnToPrevious();
             } else {
                 $this->showPage();
             }
@@ -162,7 +162,15 @@ class DeleteuserAction extends ProfileFormAction
     function handlePost()
     {
         if (Event::handle('StartDeleteUser', array($this, $this->user))) {
-            $this->user->delete();
+            // Mark the account as deleted and shove low-level deletion tasks
+            // to background queues. Removing a lot of posts can take a while...
+            if (!$this->user->hasRole(Profile_role::DELETED)) {
+                $this->user->grantRole(Profile_role::DELETED);
+            }
+
+            $qm = QueueManager::get();
+            $qm->enqueue($this->user, 'deluser');
+
             Event::handle('EndDeleteUser', array($this, $this->user));
         }
     }