[TEMPLATES] Tweak note complimentary info to not output empty <span>s

This commit is contained in:
Hugo Sales 2022-03-01 17:58:53 +00:00
parent 802a8d124a
commit 7ca4330f17
No known key found for this signature in database
GPG Key ID: 7D0C7EAFC9D835A0

View File

@ -129,19 +129,19 @@
<div class="note-complementary-info"> <div class="note-complementary-info">
{% for complementary_info in complementary_info_array %} {% for complementary_info in complementary_info_array %}
{% set formatted = [] %} {% set formatted = [] %}
{% if complementary_info['action'] is defined and not null %}
<span>
{% for complementary_info_actor in complementary_info['actors'] %} {% for complementary_info_actor in complementary_info['actors'] %}
{% if complementary_info_actor is defined and (app.user is null or complementary_info_actor.getId() != app.user.getId()) %} {% if complementary_info_actor is defined and (app.user is null or complementary_info_actor.getId() != app.user.getId()) %}
{% set tmp %}<a href="{{ complementary_info_actor.getUrl() }}">{{ complementary_info_actor.getNickname() }}</a>{% endset %} {% set tmp %}<a href="{{ complementary_info_actor.getUrl() }}">{{ complementary_info_actor.getNickname() }}</a>{% endset %}
{% set formatted = formatted|merge([tmp]) %} {% set formatted = formatted|merge([tmp]) %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if formatted is not empty %}
<span>
{{ trans( {{ trans(
{ [
'1': "{formatted} has {action} this note", "{formatted} has {action} this note",
'other': "{formatted} have {action} this note" "{formatted} have {action} this note"
}, ],
{ {
'count': formatted|length, 'count': formatted|length,
'formatted': trans_list(formatted), 'formatted': trans_list(formatted),