]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Extend Action with redirect after login logic, update some actions to use it
authorbrunoccast <brvnocasteleiro@gmail.com>
Sun, 2 Jun 2019 12:55:12 +0000 (13:55 +0100)
committerDiogo Cordeiro <diogo@fc.up.pt>
Fri, 7 Jun 2019 14:02:07 +0000 (15:02 +0100)
actions/conversation.php
actions/shownotice.php
lib/action.php
plugins/Directory/actions/groupdirectory.php
plugins/Directory/actions/userdirectory.php

index 8fcf3f47d655e1ca055530ee1798916b14f70166..e69c9c35cebc67b4acdcdd541b8ed1f5687f59d5 100644 (file)
@@ -47,6 +47,8 @@ if (!defined('GNUSOCIAL')) {
  */
 class ConversationAction extends ManagedAction
 {
+    protected $redirectAfterLogin = true;
+    
     public $conv        = null;
     public $page        = null;
     public $notices     = null;
index ea43780e1668f5464e5feacce969a0014aab335b..a2fa01d21a0822439d3a5f74f9fa320d638acfff 100644 (file)
@@ -44,6 +44,8 @@ require_once INSTALLDIR.'/lib/noticelist.php';
  */
 class ShownoticeAction extends ManagedAction
 {
+    protected $redirectAfterLogin = true;
+    
     /**
      * Notice object to show
      */
index 32b49e4e11f6e30ffdc1cb064f84102cff3fd8c5..9cde0d7637d021799a7d5f257fc6b227cdd21b26 100644 (file)
@@ -60,6 +60,7 @@ class Action extends HTMLOutputter // lawsuit
     protected $ajax = false;
     protected $menus = true;
     protected $needLogin = false;
+    protected $redirectAfterLogin = false;
     protected $needPost = false;    // implies canPost if true
     protected $canPost = false;     // can this action handle POST method?
 
@@ -248,6 +249,10 @@ class Action extends HTMLOutputter // lawsuit
         if ($this->needLogin) {
             $this->checkLogin(); // if not logged in, this redirs/excepts
         }
+        
+        if ($this->redirectAfterLogin) {
+            common_set_returnto($this->selfUrl());
+        }
 
         $this->updateScopedProfile();
 
index ecedfebd0dba058b8c70d75199b7dfe4e983efbd..83742f8c74736da726dd0a045447730c247ae624 100644 (file)
@@ -43,6 +43,8 @@ if (!defined('GNUSOCIAL')) {
  */
 class GroupdirectoryAction extends ManagedAction
 {
+    protected $redirectAfterLogin = true;
+    
     /**
      * The page we're on
      *
@@ -143,8 +145,6 @@ class GroupdirectoryAction extends ManagedAction
         $this->reverse = $this->boolean('reverse');
         $this->q       = $this->trimmed('q');
         $this->sort    = $this->arg('sort', 'nickname');
-
-        common_set_returnto($this->selfUrl());
     }
 
     /**
index 51b84ed4c1abe20f9fbf208e7390793f8a9612f0..7f6a899f1fd82eed0df49d938672843a2f2c0ce6 100644 (file)
@@ -42,6 +42,8 @@ if (!defined('GNUSOCIAL')) {
  */
 class UserdirectoryAction extends ManagedAction
 {
+    protected $redirectAfterLogin = true;
+    
     /**
      * The page we're on
      *
@@ -140,8 +142,6 @@ class UserdirectoryAction extends ManagedAction
         $this->reverse = $this->boolean('reverse');
         $this->q       = $this->trimmed('q');
         $this->sort    = $this->arg('sort', 'nickname');
-
-        common_set_returnto($this->selfUrl());
     }
 
     /**