Maintain 'page' parameter for block from subscribers list, block & make-admin from group members list.

Refactored some of the returnto handling code. It looks like we have several different ways of handling this in the software, icky!
Marked the session-based functions with fixmes (they'll stomp on other forms when multiple tabs/windows are used) and combined some commonish bits of code between ProfileFormAction and the group block & makeadmin actions where they're using hidden form parameters. Extended that to allow passing dynamic parameters (eg 'page') as well as static ones (action, target user/group).
This commit is contained in:
Brion Vibber
2010-04-08 19:06:55 -07:00
parent 4b2dfabff8
commit 5dbaaed4e6
7 changed files with 179 additions and 67 deletions

View File

@@ -41,7 +41,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
* @link http://status.net/
*/
class MakeadminAction extends Action
class MakeadminAction extends RedirectingAction
{
var $profile = null;
var $group = null;
@@ -148,20 +148,19 @@ class MakeadminAction extends Action
$this->group->getBestName());
}
foreach ($this->args as $k => $v) {
if ($k == 'returnto-action') {
$action = $v;
} else if (substr($k, 0, 9) == 'returnto-') {
$args[substr($k, 9)] = $v;
}
}
if ($action) {
common_redirect(common_local_url($action, $args), 303);
} else {
common_redirect(common_local_url('groupmembers',
array('nickname' => $this->group->nickname)),
303);
}
$this->returnToArgs();
}
/**
* If we reached this form without returnto arguments, default to
* the top of the group's member list.
*
* @return string URL
*/
function defaultReturnTo()
{
return common_local_url('groupmembers',
array('nickname' => $this->group->nickname));
}
}