[UI] Only show note action buttons if a user is logged in
This commit is contained in:
parent
2164f21834
commit
0a56061639
@ -60,11 +60,6 @@ class Runtime implements RuntimeExtensionInterface, EventSubscriberInterface
|
||||
|
||||
public function getNoteActions(Note $note)
|
||||
{
|
||||
// Only show buttons if a user is logged in
|
||||
if (Common::user() == null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$actions = [];
|
||||
Event::handle('add_note_actions', [$this->request, $note, &$actions]);
|
||||
return $actions;
|
||||
|
@ -92,7 +92,7 @@
|
||||
{% if notes is defined and notes is not empty %}
|
||||
{% for note in notes %}
|
||||
{% set id = note.getId() - 1 %}
|
||||
{% include '/note/view.html.twig' with {'note': note} only %}
|
||||
{% include '/note/view.html.twig' with {'note': note, 'have_user': have_user} only %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<h1>{% trans %}No notes here.{% endtrans %}</h1>
|
||||
|
@ -29,7 +29,7 @@
|
||||
{{ parent() }}
|
||||
<div class="content">
|
||||
<div class="main">
|
||||
{% include '/note/view.html.twig' with {'note': note} only %}
|
||||
{% include '/note/view.html.twig' with {'note': note, 'have_user': have_user} only %}
|
||||
{{ form(reply) }}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -35,18 +35,15 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="note-actions">
|
||||
{% for act in get_note_actions(note) %}
|
||||
{{ form(act) }}
|
||||
{% endfor %}
|
||||
<a href="{{ path('note_reply', {'reply_to': note.getId()}) }}">
|
||||
<svg class="icon icon-reply">
|
||||
<use xlink:href="#icon-reply"></use>
|
||||
</svg>
|
||||
</a>
|
||||
{% if have_user %}
|
||||
{% for act in get_note_actions(note) %}
|
||||
{{ form(act) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="replies">
|
||||
{% for reply in note.getReplies() %}
|
||||
{% include '/note/view.html.twig' with {'note': reply, 'skip_reply_to': true} only %}
|
||||
{% include '/note/view.html.twig' with {'note': reply, 'skip_reply_to': true, 'have_user': have_user} only %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user