optimize usage of arguments
This commit is contained in:
parent
12e223b2ef
commit
4d545825f0
2 changed files with 9 additions and 14 deletions
|
@ -20,21 +20,16 @@ class HoverCard extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
/** @var Arguments $args */
|
|
||||||
$args = self::getClass(Arguments::class);
|
|
||||||
|
|
||||||
$a = self::getApp();
|
$a = self::getApp();
|
||||||
|
|
||||||
// A logged in user views a profile of a user
|
if ((local_user()) && ($parameters['action'] ?? '') === 'view') {
|
||||||
if ((local_user()) && $args->get(2) === 'view') {
|
// A logged in user views a profile of a user
|
||||||
$nickname = $a->user['nickname'];
|
$nickname = $a->user['nickname'];
|
||||||
$profile = $parameters['profile'];
|
$profile = $parameters['profile'];
|
||||||
|
} elseif (empty($parameters['action'])) {
|
||||||
// Show the profile hovercard
|
// Show the profile hovercard
|
||||||
} elseif ($args->getArgc() == 2) {
|
|
||||||
$nickname = $parameters['profile'];
|
$nickname = $parameters['profile'];
|
||||||
$profile = 0;
|
$profile = 0;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/** @var L10n $l10n */
|
/** @var L10n $l10n */
|
||||||
$l10n = self::getClass(L10n::class);
|
$l10n = self::getClass(L10n::class);
|
||||||
|
|
|
@ -139,12 +139,12 @@ return [
|
||||||
'/{group:\d+}/add/{contact:\d+}' => [Module\Group::class, [R::GET, R::POST]],
|
'/{group:\d+}/add/{contact:\d+}' => [Module\Group::class, [R::GET, R::POST]],
|
||||||
'/{group:\d+}/remove/{contact:\d+}' => [Module\Group::class, [R::GET, R::POST]],
|
'/{group:\d+}/remove/{contact:\d+}' => [Module\Group::class, [R::GET, R::POST]],
|
||||||
],
|
],
|
||||||
'/hashtag' => [Module\Hashtag::class, [R::GET]],
|
'/hashtag' => [Module\Hashtag::class, [R::GET]],
|
||||||
'/help[/{doc:.+}]' => [Module\Help::class, [R::GET]],
|
'/help[/{doc:.+}]' => [Module\Help::class, [R::GET]],
|
||||||
'/home' => [Module\Home::class, [R::GET]],
|
'/home' => [Module\Home::class, [R::GET]],
|
||||||
'/hcard/{profile}[/{view}]' => [Module\HoverCard::class, [R::GET]],
|
'/hcard/{profile}[/{action}]' => [Module\HoverCard::class, [R::GET]],
|
||||||
'/inbox[/{nickname}]' => [Module\Inbox::class, [R::GET, R::POST]],
|
'/inbox[/{nickname}]' => [Module\Inbox::class, [R::GET, R::POST]],
|
||||||
'/invite' => [Module\Invite::class, [R::GET, R::POST]],
|
'/invite' => [Module\Invite::class, [R::GET, R::POST]],
|
||||||
|
|
||||||
'/install' => [
|
'/install' => [
|
||||||
'[/]' => [Module\Install::class, [R::GET, R::POST]],
|
'[/]' => [Module\Install::class, [R::GET, R::POST]],
|
||||||
|
|
Loading…
Reference in a new issue