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