[CONTROLLER][Actor] Fix actor view route

This commit is contained in:
Hugo Sales 2021-12-21 16:40:46 +00:00
parent 8b5286c383
commit af122df6e1
No known key found for this signature in database
GPG Key ID: 7D0C7EAFC9D835A0
3 changed files with 4 additions and 2 deletions

View File

@ -45,6 +45,7 @@ class Actor extends ActorController
fn ($actor) => [ fn ($actor) => [
'_template' => 'actor/view.html.twig', '_template' => 'actor/view.html.twig',
'actor' => $actor, 'actor' => $actor,
'nickname' => $actor->getNickname(),
], ],
); );
} }
@ -56,6 +57,7 @@ class Actor extends ActorController
fn ($actor) => [ fn ($actor) => [
'_template' => 'actor/view.html.twig', '_template' => 'actor/view.html.twig',
'actor' => $actor, 'actor' => $actor,
'nickname' => $actor->getNickname(),
'notes' => \App\Entity\Note::getAllNotesByActor($actor), 'notes' => \App\Entity\Note::getAllNotesByActor($actor),
], ],
); );

View File

@ -46,7 +46,7 @@ abstract class Actor
public static function load(RouteLoader $r): void public static function load(RouteLoader $r): void
{ {
$r->connect(id: 'actor_view_id', uri_path: '/actor/{id<\d+>}', target: [C\Actor::class, 'actorViewId']); $r->connect(id: 'actor_view_id', uri_path: '/actor/{id<\d+>}', target: [C\Actor::class, 'actorViewId']);
$r->connect(id: 'actor_view_nickname', uri_path: '/@{nickname<' . Nickname::DISPLAY_FMT . '>}', target: [C\Actor::class, 'actorViewId'], options: ['is_system_path' => false]); $r->connect(id: 'actor_view_nickname', uri_path: '/@{nickname<' . Nickname::DISPLAY_FMT . '>}', target: [C\Actor::class, 'actorViewNickname'], options: ['is_system_path' => false]);
$r->connect(id: 'group_actor_view_id', uri_path: '/group/{id<\d+>}', target: [C\Actor::class, 'groupViewId']); $r->connect(id: 'group_actor_view_id', uri_path: '/group/{id<\d+>}', target: [C\Actor::class, 'groupViewId']);
$r->connect(id: 'group_actor_view_nickname', uri_path: '/!{nickname<' . Nickname::DISPLAY_FMT . '>}', target: [C\Actor::class, 'groupViewNickname'], options: ['is_system_path' => false]); $r->connect(id: 'group_actor_view_nickname', uri_path: '/!{nickname<' . Nickname::DISPLAY_FMT . '>}', target: [C\Actor::class, 'groupViewNickname'], options: ['is_system_path' => false]);
} }

View File

@ -3,7 +3,7 @@
{% set nickname = nickname|escape %} {% set nickname = nickname|escape %}
{% block title %}{% trans with {'%nick%': actor.getNickname()} %}%nick%'s profile{% endtrans %}{% endblock %}y {% block title %}{% trans %}%nickname%'s profile{% endtrans %}{% endblock %}
{% block stylesheets %} {% block stylesheets %}
{{ parent() }} {{ parent() }}