[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">
{% for complementary_info in complementary_info_array %}
{% set formatted = [] %}
{% if complementary_info['action'] is defined and not null %}
{% 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()) %}
{% set tmp %}<a href="{{ complementary_info_actor.getUrl() }}">{{ complementary_info_actor.getNickname() }}</a>{% endset %}
{% set formatted = formatted|merge([tmp]) %}
{% endif %}
{% endfor %}
{% if formatted is not empty %}
<span>
{% 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()) %}
{% set tmp %}<a href="{{ complementary_info_actor.getUrl() }}">{{ complementary_info_actor.getNickname() }}</a>{% endset %}
{% set formatted = formatted|merge([tmp]) %}
{% endif %}
{% endfor %}
{{ trans(
{
'1': "{formatted} has {action} this note",
'other': "{formatted} have {action} this note"
},
[
"{formatted} has {action} this note",
"{formatted} have {action} this note"
],
{
'count': formatted|length,
'formatted': trans_list(formatted),