forked from GNUsocial/gnu-social
Make lists work in single-user mode
Added routes to the router for list pages in single-user mode. For each of the actions in those routes, use the global single-user nickname rather than a nickname URL argument to determine the tagger ID. In nav, and for Ajax, provide the right nicknames.
This commit is contained in:
parent
797e187acb
commit
32845a1051
@ -71,7 +71,11 @@ class EditpeopletagAction extends Action
|
||||
}
|
||||
|
||||
$id = $this->arg('id');
|
||||
$tagger_arg = $this->arg('tagger');
|
||||
if (common_config('singleuser', 'enabled')) {
|
||||
$tagger_arg = User::singleUserNickname();
|
||||
} else {
|
||||
$tagger_arg = $this->arg('tagger');
|
||||
}
|
||||
$tag_arg = $this->arg('tag');
|
||||
|
||||
$tagger = common_canonical_nickname($tagger_arg);
|
||||
|
@ -58,7 +58,12 @@ class PeopletaggedAction extends Action
|
||||
parent::prepare($args);
|
||||
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
|
||||
|
||||
$tagger_arg = $this->arg('tagger');
|
||||
if (common_config('singleuser', 'enabled')) {
|
||||
$tagger_arg = User::singleUserNickname();
|
||||
} else {
|
||||
$tagger_arg = $this->arg('tagger');
|
||||
}
|
||||
|
||||
$tag_arg = $this->arg('tag');
|
||||
$tagger = common_canonical_nickname($tagger_arg);
|
||||
$tag = common_canonical_tag($tag_arg);
|
||||
|
@ -76,7 +76,12 @@ class PeopletagsbyuserAction extends Action
|
||||
$this->args['public'] = $this->args['private'] = false;
|
||||
}
|
||||
|
||||
$nickname_arg = $this->arg('nickname');
|
||||
if (common_config('singleuser', 'enabled')) {
|
||||
$nickname_arg = User::singleUserNickname();
|
||||
} else {
|
||||
$nickname_arg = $this->arg('nickname');
|
||||
}
|
||||
|
||||
$nickname = common_canonical_nickname($nickname_arg);
|
||||
|
||||
// Permanent redirect on non-canonical nickname
|
||||
|
@ -58,7 +58,12 @@ class PeopletagsforuserAction extends Action
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$nickname_arg = $this->arg('nickname');
|
||||
if (common_config('singleuser', 'enabled')) {
|
||||
$nickname_arg = User::singleUserNickname();
|
||||
} else {
|
||||
$nickname_arg = $this->arg('nickname');
|
||||
}
|
||||
|
||||
$nickname = common_canonical_nickname($nickname_arg);
|
||||
|
||||
// Permanent redirect on non-canonical nickname
|
||||
|
@ -58,7 +58,12 @@ class PeopletagsubscribersAction extends Action
|
||||
parent::prepare($args);
|
||||
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
|
||||
|
||||
$tagger_arg = $this->arg('tagger');
|
||||
if (common_config('singleuser', 'enabled')) {
|
||||
$tagger_arg = User::singleUserNickname();
|
||||
} else {
|
||||
$tagger_arg = $this->arg('tagger');
|
||||
}
|
||||
|
||||
$tag_arg = $this->arg('tag');
|
||||
$tagger = common_canonical_nickname($tagger_arg);
|
||||
$tag = common_canonical_tag($tag_arg);
|
||||
|
@ -60,7 +60,12 @@ class PeopletagsubscriptionsAction extends Action
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$nickname_arg = $this->arg('nickname');
|
||||
if (common_config('singleuser', 'enabled')) {
|
||||
$nickname_arg = User::singleUserNickname();
|
||||
} else {
|
||||
$nickname_arg = $this->arg('nickname');
|
||||
}
|
||||
|
||||
$nickname = common_canonical_nickname($nickname_arg);
|
||||
|
||||
// Permanent redirect on non-canonical nickname
|
||||
|
@ -44,7 +44,11 @@ class ShowprofiletagAction extends Action
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$tagger_arg = $this->arg('tagger');
|
||||
if (common_config('singleuser', 'enabled')) {
|
||||
$tagger_arg = User::singleUserNickname();
|
||||
} else {
|
||||
$tagger_arg = $this->arg('tagger');
|
||||
}
|
||||
$tag_arg = $this->arg('tag');
|
||||
$tagger = common_canonical_nickname($tagger_arg);
|
||||
$tag = common_canonical_tag($tag_arg);
|
||||
|
@ -328,10 +328,8 @@ class Action extends HTMLOutputter // lawsuit
|
||||
}
|
||||
// This route isn't available in single-user mode.
|
||||
// Not sure why, but it causes errors here.
|
||||
if (!common_config('singleuser', 'enabled')) {
|
||||
$this->inlineScript('var _peopletagAC = "' .
|
||||
common_local_url('peopletagautocomplete') . '";');
|
||||
}
|
||||
$this->inlineScript('var _peopletagAC = "' .
|
||||
common_local_url('peopletagautocomplete') . '";');
|
||||
$this->showScriptMessages();
|
||||
// Anti-framing code to avoid clickjacking attacks in older browsers.
|
||||
// This will show a blank page if the page is being framed, which is
|
||||
|
@ -79,7 +79,13 @@ class PeopletagGroupNav extends Widget
|
||||
// FIXME: we should probably pass this in
|
||||
|
||||
$action = $this->action->trimmed('action');
|
||||
$nickname = $this->action->trimmed('tagger');
|
||||
|
||||
if (common_config('singleuser', 'enabled')) {
|
||||
$nickname = User::singleUserNickname();
|
||||
} else {
|
||||
$nickname = $this->action->arg('tagger');
|
||||
}
|
||||
|
||||
$tag = $this->action->trimmed('tag');
|
||||
|
||||
if ($nickname) {
|
||||
|
@ -817,6 +817,22 @@ class Router
|
||||
array('action' => 'getfile'),
|
||||
array('filename' => '[A-Za-z0-9._-]+'));
|
||||
|
||||
// Common people-tag stuff
|
||||
|
||||
$m->connect('peopletag/:tag', array('action' => 'peopletag',
|
||||
'tag' => self::REGEX_TAG));
|
||||
|
||||
$m->connect('selftag/:tag', array('action' => 'selftag',
|
||||
'tag' => self::REGEX_TAG));
|
||||
|
||||
$m->connect('main/addpeopletag', array('action' => 'addpeopletag'));
|
||||
|
||||
$m->connect('main/removepeopletag', array('action' => 'removepeopletag'));
|
||||
|
||||
$m->connect('main/profilecompletion', array('action' => 'profilecompletion'));
|
||||
|
||||
$m->connect('main/peopletagautocomplete', array('action' => 'peopletagautocomplete'));
|
||||
|
||||
// In the "root"
|
||||
|
||||
if (common_config('singleuser', 'enabled')) {
|
||||
@ -880,6 +896,57 @@ class Router
|
||||
$m->connect('',
|
||||
array('action' => 'showstream',
|
||||
'nickname' => $nickname));
|
||||
|
||||
// peopletags
|
||||
|
||||
$m->connect('peopletags',
|
||||
array('action' => 'peopletagsbyuser'));
|
||||
|
||||
$m->connect('peopletags/private',
|
||||
array('action' => 'peopletagsbyuser',
|
||||
'private' => 1));
|
||||
|
||||
$m->connect('peopletags/public',
|
||||
array('action' => 'peopletagsbyuser',
|
||||
'public' => 1));
|
||||
|
||||
$m->connect('othertags',
|
||||
array('action' => 'peopletagsforuser'));
|
||||
|
||||
$m->connect('peopletagsubscriptions',
|
||||
array('action' => 'peopletagsubscriptions'));
|
||||
|
||||
$m->connect('all/:tag/subscribers',
|
||||
array('action' => 'peopletagsubscribers',
|
||||
'tag' => self::REGEX_TAG));
|
||||
|
||||
$m->connect('all/:tag/tagged',
|
||||
array('action' => 'peopletagged',
|
||||
'tag' => self::REGEX_TAG));
|
||||
|
||||
$m->connect('all/:tag/edit',
|
||||
array('action' => 'editpeopletag',
|
||||
'tag' => self::REGEX_TAG));
|
||||
|
||||
foreach(array('subscribe', 'unsubscribe') as $v) {
|
||||
$m->connect('peopletag/:id/'.$v,
|
||||
array('action' => $v.'peopletag',
|
||||
'id' => '[0-9]{1,64}'));
|
||||
}
|
||||
$m->connect('user/:tagger_id/profiletag/:id/id',
|
||||
array('action' => 'profiletagbyid',
|
||||
'tagger_id' => '[0-9]+',
|
||||
'id' => '[0-9]+'));
|
||||
|
||||
$m->connect('all/:tag',
|
||||
array('action' => 'showprofiletag',
|
||||
'tag' => self::REGEX_TAG));
|
||||
|
||||
foreach (array('subscriptions', 'subscribers') as $a) {
|
||||
$m->connect($a.'/:tag',
|
||||
array('action' => $a),
|
||||
array('tag' => self::REGEX_TAG));
|
||||
}
|
||||
} else {
|
||||
$m->connect('', array('action' => 'public'));
|
||||
$m->connect('rss', array('action' => 'publicrss'));
|
||||
@ -904,20 +971,6 @@ class Router
|
||||
|
||||
// people tags
|
||||
|
||||
$m->connect('peopletag/:tag', array('action' => 'peopletag',
|
||||
'tag' => self::REGEX_TAG));
|
||||
|
||||
$m->connect('selftag/:tag', array('action' => 'selftag',
|
||||
'tag' => self::REGEX_TAG));
|
||||
|
||||
$m->connect('main/addpeopletag', array('action' => 'addpeopletag'));
|
||||
|
||||
$m->connect('main/removepeopletag', array('action' => 'removepeopletag'));
|
||||
|
||||
$m->connect('main/profilecompletion', array('action' => 'profilecompletion'));
|
||||
|
||||
$m->connect('main/peopletagautocomplete', array('action' => 'peopletagautocomplete'));
|
||||
|
||||
$m->connect(':nickname/peopletags',
|
||||
array('action' => 'peopletagsbyuser',
|
||||
'nickname' => Nickname::DISPLAY_FMT));
|
||||
|
Loading…
Reference in New Issue
Block a user