diff --git a/src/Controller/Actor.php b/src/Controller/Actor.php index 961af956fa..424e622847 100644 --- a/src/Controller/Actor.php +++ b/src/Controller/Actor.php @@ -130,7 +130,7 @@ class Actor extends ActorController } } - $notes = DB::dql( + $notes = !\is_null($group) ? DB::dql( <<<'EOF' select n from note n join activity a with n.id = a.object_id @@ -138,12 +138,12 @@ class Actor extends ActorController where a.object_type = 'note' and gi.group_id = :group_id EOF, ['group_id' => $group->getId()], - ); + ) : []; return [ '_template' => 'actor/group_view.html.twig', 'actor' => $group, - 'nickname' => $group->getNickname(), + 'nickname' => $group?->getNickname() ?? $nickname, 'notes' => $notes, ]; } diff --git a/templates/actor/group_view.html.twig b/templates/actor/group_view.html.twig index 193d2fbc8b..8a862ccd05 100644 --- a/templates/actor/group_view.html.twig +++ b/templates/actor/group_view.html.twig @@ -1,8 +1,7 @@ {% extends 'stdgrid.html.twig' %} {% import '/cards/note/view.html.twig' as noteView %} - - +{% set nickname = nickname|escape %} {% block title %}{{ nickname }}{% endblock %} {% block stylesheets %} @@ -38,8 +37,11 @@ {% else %}
-

{% trans with { '%group%': nickname } %}The group %group% doesn't exist. Would you like to create it?{% endtrans %}

- {{ form(create_form) }} +

{% trans with { '%group%': nickname } %}The group %group% doesn't exist.{% endtrans %}

+ {% if create_form is defined and create_form is not null %} +

{% trans %}Would you like to create it?{% endtrans %}

+ {{ form(create_form) }} + {% endif %}
{% endif %} {% endblock body %}