forked from GNUsocial/gnu-social
[CARD][Note] Refactor notification targets
This commit is contained in:
parent
d91bc5ec66
commit
1244f64bb2
@ -93,28 +93,42 @@
|
||||
</header>
|
||||
{% endblock note_info %}
|
||||
|
||||
{% macro mention_anchor(target) %}
|
||||
<a href='{{target.getUrl()}}'>{{mention(target)}}<a>
|
||||
{% endmacro mention_anchor %}
|
||||
|
||||
{% block note_context %}
|
||||
{% set notification_targets = note.getNotificationTargets() %}
|
||||
{% if notification_targets is not empty %}
|
||||
{% for target in notification_targets %}
|
||||
{% if target.isGroup() %}
|
||||
<em tabindex="0"
|
||||
class="note-replies-parent"
|
||||
title="{% trans %}The group in which this note was addressed to{% endtrans %}">
|
||||
{% set mentionAnchor %}<a href="{{ target.getUrl() }}">{{ mention(target) | raw }}</a>{% endset %}
|
||||
{% trans %}in %mentionAnchor%{% endtrans %}
|
||||
</em>
|
||||
{% else %}
|
||||
<em tabindex="0"
|
||||
class="note-replies-parent"
|
||||
title="{% trans %}Whom this is a reply to{% endtrans %}"
|
||||
aria-flowto="note-anchor-{{ note.getReplyTo() }}">
|
||||
{% set replyAnchor %}<a href="{{ note.getConversationUrl() ~ "#note-anchor-" ~ note.getReplyTo() }}">{% endset %}
|
||||
{% set mentionAnchor %}<a href="{{ target.getUrl() }}">{{ mention(target) | raw }}</a>{% endset %}
|
||||
{% trans %}%replyAnchor% in reply to %mentionAnchor%{% endtrans %}
|
||||
</em>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% set notification_targets_individuals = notification_targets|filter(nt => nt.isGroup() == false) %}
|
||||
{% set mention_individuals = [] %}
|
||||
{% for target in notification_targets_individuals %}
|
||||
{% set mention_individuals = mention_individuals|merge([_self.mention_anchor(target)]) %}
|
||||
{% endfor %}
|
||||
|
||||
{% set notification_targets_groups = notification_targets|filter(nt => nt.isGroup()) %}
|
||||
{% set mention_groups = [] %}
|
||||
{% for target in notification_targets_groups %}
|
||||
{% set mention_groups = mention_groups|merge([_self.mention_anchor(target)]) %}
|
||||
{% endfor %}
|
||||
|
||||
{% if notification_targets_individuals is not empty %}
|
||||
<em tabindex="0"
|
||||
class="note-replies-parent"
|
||||
title="{{'Whom this is a reply to' | trans}}"
|
||||
aria-flowto="note-anchor-{{ note.getReplyTo() }}">
|
||||
{% set mentions_anchors = mention_individuals|join(' ⃕ ') %}
|
||||
<a href="{{ note.getConversationUrl() ~ '#note-anchor-' ~ note.getReplyTo() }}">{% trans %}in reply to %mentions_anchors%{% endtrans %}</a>
|
||||
</em>
|
||||
{% endif %}
|
||||
|
||||
{% if notification_targets_groups is not empty %}
|
||||
<em tabindex="0"
|
||||
class="note-replies-parent"
|
||||
title="{{'Group/Organisation this note is intended for' | trans}}"
|
||||
aria-flowto="note-anchor-{{ note.getReplyTo() }}">
|
||||
{% set mentions_anchors = mention_groups|join(', ', ' and ') %}
|
||||
{% trans %}in %mentions_anchors%{% endtrans %}
|
||||
</em>
|
||||
{% endif %}
|
||||
{% endblock note_context %}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user