[CONTROLLER][Actor] Add group notes query and fixup template

This commit is contained in:
Hugo Sales 2021-12-21 12:47:16 +00:00
parent 6a8144003f
commit e7dcea3f26
No known key found for this signature in database
GPG Key ID: 7D0C7EAFC9D835A0
3 changed files with 24 additions and 5 deletions

View File

@ -128,10 +128,21 @@ class Actor extends ActorController
} }
} }
$notes = DB::dql(
<<<'EOF'
select n from note n
join activity a with n.id = a.object_id
join group_inbox gi with a.id = gi.activity_id
where a.object_type = 'note' and gi.group_id = :group_id
EOF,
['group_id' => $group->getId()],
);
return [ return [
'_template' => 'actor/group_view.html.twig', '_template' => 'actor/group_view.html.twig',
'actor' => $group, 'actor' => $group,
'nickname' => $group->getNickname(), 'nickname' => $group->getNickname(),
'notes' => $notes,
]; ];
} }
} }

View File

@ -1,7 +1,7 @@
{% extends 'stdgrid.html.twig' %} {% extends 'stdgrid.html.twig' %}
{% import '/cards/note/view.html.twig' as noteView %} {% import '/cards/note/view.html.twig' as noteView %}
{% set nickname = nickname|escape %}
{% block title %}{{ nickname }}{% endblock %} {% block title %}{{ nickname }}{% endblock %}
@ -20,9 +20,13 @@
<main class="feed" tabindex="0" role="feed"> <main class="feed" tabindex="0" role="feed">
<div class="h-feed hfeed notes"> <div class="h-feed hfeed notes">
{% if notes is defined and notes is not empty %} {% if notes is defined and notes is not empty %}
{% for note in notes %} {% for conversation in notes %}
{% block current_note %} {% block current_note %}
{{ noteView.macro_note(note, null) }} {% if conversation is instanceof('array') %}
{{ noteView.macro_note(conversation['note'], conversation['replies']) }}
{% else %}
{{ noteView.macro_note(conversation) }}
{% endif %}
<hr tabindex="0" title="{{ 'End of note and replies.' | trans }}"> <hr tabindex="0" title="{{ 'End of note and replies.' | trans }}">
{% endblock current_note %} {% endblock current_note %}
{% endfor %} {% endfor %}

View File

@ -18,9 +18,13 @@
<main class="feed" tabindex="0" role="feed"> <main class="feed" tabindex="0" role="feed">
<div class="h-feed hfeed notes"> <div class="h-feed hfeed notes">
{% if notes is defined and notes is not empty %} {% if notes is defined and notes is not empty %}
{% for note in notes %} {% for conversation in notes %}
{% block current_note %} {% block current_note %}
{{ noteView.macro_note(note, null) }} {% if conversation is instanceof('array') %}
{{ noteView.macro_note(conversation['note'], conversation['replies']) }}
{% else %}
{{ noteView.macro_note(conversation) }}
{% endif %}
<hr tabindex="0" title="{{ 'End of note and replies.' | trans }}"> <hr tabindex="0" title="{{ 'End of note and replies.' | trans }}">
{% endblock current_note %} {% endblock current_note %}
{% endfor %} {% endfor %}