]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
common_redirect and clientError exits, so refactor
authorMikael Nordfeldth <mmn@hethane.se>
Sun, 9 Mar 2014 22:22:05 +0000 (23:22 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Sun, 9 Mar 2014 23:24:32 +0000 (00:24 +0100)
One Event would never be called, and other stuff were redundant clauses.

actions/userrss.php
plugins/EmailRegistration/actions/emailregister.php
plugins/FacebookBridge/actions/facebookfinishlogin.php
plugins/GNUsocialPhotos/actions/editphoto.php

index 3a7332088dd93a2688adb15eaf8dbb23c2dac80d..308db948918c079a9d4a1ce63463840c3b564a82 100644 (file)
@@ -37,15 +37,15 @@ class UserrssAction extends Rss10Action
         if (!$this->user) {
             // TRANS: Client error displayed when user not found for an action.
             $this->clientError(_('No such user.'));
-            return false;
+        }
+
+        if (!empty($this->tag)) {
+            $this->notices = $this->getTaggedNotices();
         } else {
-            if (!empty($this->tag)) {
-                $this->notices = $this->getTaggedNotices();
-            } else {
-                $this->notices = $this->getNotices();
-            }
-            return true;
+            $this->notices = $this->getNotices();
         }
+
+        return true;
     }
 
     function getTaggedNotices()
index 5eaf84ad5402859ea3916a8b311459991bee9993..39eb76d599432b9fc17a7c55906b2d482573e90f 100644 (file)
@@ -332,9 +332,9 @@ class EmailregisterAction extends Action
         }
 
         if (Event::handle('StartRegisterSuccess', array($this))) {
-            common_redirect(common_local_url('doc', array('title' => 'welcome')),
-                            303);
             Event::handle('EndRegisterSuccess', array($this));
+            common_redirect(common_local_url('doc', array('title' => 'welcome')), 303);
+            // common_redirect exits, so we can't run the event _after_ it of course.
         }
     }
 
index 66ac174ef2c0aede4d3e1f6c25c2f31d99a22c10..ab83601ce1e976089bbbb26a114888add976f494 100644 (file)
@@ -54,12 +54,7 @@ class FacebookfinishloginAction extends Action
         $graphUrl = 'https://graph.facebook.com/me?access_token=' . urlencode($this->accessToken);
         $this->fbuser = json_decode(file_get_contents($graphUrl));
 
-        if (!empty($this->fbuser)) {
-            $this->fbuid  = $this->fbuser->id;
-            // OKAY, all is well... proceed to register
-            return true;
-        } else {
-
+        if (empty($this->fbuser)) {
             // log badness
 
             list($proxy, $ip) = common_client_ip();
@@ -80,7 +75,9 @@ class FacebookfinishloginAction extends Action
             );
         }
 
-        return false;
+        $this->fbuid  = $this->fbuser->id;
+        // OKAY, all is well... proceed to register
+        return true;
     }
 
     function handle($args)
index 7ac8104ae8be87fdbbcec6da290ea48021068b97..8f719919f970ffdf4255c603d368e740e7f257fa 100644 (file)
@@ -179,8 +179,7 @@ class EditphotoAction extends Action
             return;
         }
         common_redirect('/photo/' . $this->photo->id, '303');
-        $this->showForm(_('Success!'), true);
-
+        // common_redirect exits
     }
 
     function deletePhoto()
@@ -198,7 +197,6 @@ class EditphotoAction extends Action
         }
        $this->showForm(_('Success!'));
         common_redirect('/' . $this->user->nickname . '/photos/' . $oldalbum, '303');
-        return;
     }
 
 }