Extend Action with redirect after login logic, update some actions to use it

This commit is contained in:
brunoccast 2019-06-02 13:55:12 +01:00 committed by Diogo Cordeiro
parent 691df04103
commit 43df2d201c
5 changed files with 13 additions and 4 deletions

View File

@ -47,6 +47,8 @@ if (!defined('GNUSOCIAL')) {
*/
class ConversationAction extends ManagedAction
{
protected $redirectAfterLogin = true;
public $conv = null;
public $page = null;
public $notices = null;

View File

@ -44,6 +44,8 @@ require_once INSTALLDIR.'/lib/noticelist.php';
*/
class ShownoticeAction extends ManagedAction
{
protected $redirectAfterLogin = true;
/**
* Notice object to show
*/

View 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();

View 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());
}
/**

View 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());
}
/**