]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/editpeopletag.php
Profile/Peopletag file splitting for autoload
[quix0rs-gnu-social.git] / actions / editpeopletag.php
index 72dcc0df723cca9ff664797551ef0be0045ea487..45c8adaa7d59fc933a4ec70ddb157c5dfebfdc0f 100644 (file)
@@ -67,7 +67,6 @@ class EditpeopletagAction extends Action
         if (!common_logged_in()) {
             // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
             $this->clientError(_('Not logged in.'));
-            return false;
         }
 
         $id = $this->arg('id');
@@ -88,7 +87,6 @@ class EditpeopletagAction extends Action
         if ($tagger_arg != $tagger || $tag_arg != $tag) {
             $args = array('tagger' => $tagger, 'tag' => $tag);
             common_redirect(common_local_url('editpeopletag', $args), 301);
-            return false;
         }
 
         $user = null;
@@ -101,7 +99,6 @@ class EditpeopletagAction extends Action
             if (!$tagger) {
                 // TRANS: Error message displayed when trying to perform an action that requires a tagging user or ID.
                 $this->clientError(_('No tagger or ID.'), 404);
-                return false;
             }
 
             $user = User::getKV('nickname', $tagger);
@@ -111,20 +108,17 @@ class EditpeopletagAction extends Action
         if (!$this->peopletag) {
             // TRANS: Client error displayed when referring to a non-existing list.
             $this->clientError(_('No such list.'), 404);
-            return false;
         }
 
         if (!$user) {
             // This should not be happening
             // TRANS: Client error displayed when referring to non-local user.
             $this->clientError(_('Not a local user.'), 404);
-            return false;
         }
 
         if ($current->id != $user->id) {
             // TRANS: Client error displayed when reting to edit a tag that was not self-created.
             $this->clientError(_('You must be the creator of the tag to edit it.'), 404);
-            return false;
         }
 
         $this->tagger = $user->getProfile();
@@ -283,6 +277,14 @@ class EditpeopletagAction extends Action
             return;
         }
 
+        // We tested $delete && !$confirm earlier so confirmation is required before getting here
+        if ($delete) {
+            // This might take quite a bit of time.
+            $this->peopletag->delete();
+            // send home.
+            common_redirect(common_local_url('all', array('nickname' => $this->tagger->getNickname())), 303);
+        }
+
         $this->peopletag->query('BEGIN');
 
         $orig = clone($this->peopletag);
@@ -307,15 +309,6 @@ class EditpeopletagAction extends Action
             Profile_tag_subscription::cleanup($this->peopletag);
         }
 
-        if ($delete) {
-            // This might take quite a bit of time.
-            $this->peopletag->delete();
-            // send home.
-            common_redirect(common_local_url('all',
-                                         array('nickname' => $this->tagger->nickname)),
-                            303);
-        }
-
         if ($tag != $orig->tag) {
             common_redirect(common_local_url('editpeopletag',
                                              array('tagger' => $this->tagger->nickname,