Diogo Peralta Cordeiro
888c3798b7
Fixed various bugs Some important concepts to bear in mind: * Notification: Associated with activities, won't be reconstructed together with objects, can be thought of as transient * Attention: Associated with objects, will be reconstructed with them, can be thought as persistent * Notifications and Attentions have no direct implications. * Mentions are a specific form of attentions in notes, leads to the creation of Attentions. Finally, Potential PHP issue detected and reported: https://github.com/php/php-src/issues/8199 `static::method()` from a non static context (such as a class method) calls `__call`, rather than the expected `__callStatic`. Can be fixed by using `(static fn() => static::method())()`, but the usage of the magic method is strictly unnecessary in this case.
171 lines
8.0 KiB
Twig
171 lines
8.0 KiB
Twig
{% block note_actions %}
|
|
{% if app.user or note_actions_hide is defined %}
|
|
<menu class="note-actions">
|
|
<li class="note-actions-extra">
|
|
<details class="note-actions-extra-details">
|
|
<summary>
|
|
{{ icon('kebab', 'icon icon-note-actions-extra') | raw }}
|
|
</summary>
|
|
<menu>
|
|
<a href="{{ note.getUrl() }}">{% trans %}Permalink{% endtrans %}</a>
|
|
<hr>
|
|
{% for current_action in get_extra_note_actions(note) %}
|
|
<a class="{{ current_action["classes"] }}" href="{{ current_action["url"] }}">{{ current_action['title'] }}</a>
|
|
{% endfor %}
|
|
</menu>
|
|
</details>
|
|
</li>
|
|
{% for current_action in get_note_actions(note) %}
|
|
<li><a title="{{ current_action["title"] | trans }}" class="{{ current_action["classes"] }}" href="{{ current_action["url"] }}"></a></li>
|
|
{% endfor %}
|
|
</menu>
|
|
{% endif %}
|
|
{% endblock note_actions %}
|
|
|
|
{% block note_attachments %}
|
|
{% if hide_attachments is not defined %}
|
|
{% if note.getAttachments() is not empty %}
|
|
<section class="note-attachments" tabindex="0"
|
|
title="{% trans %}Attachments for this note{% endtrans %}">
|
|
{% for attachment in note.getAttachments() %}
|
|
{% include 'cards/blocks/attachment.html.twig' with {'attachment': attachment, 'note': note, 'title': attachment.getBestTitle(note)} only %}
|
|
{% endfor %}
|
|
</section>
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endblock note_attachments %}
|
|
|
|
{% block note_links %}
|
|
{% if note.getLinks() is not empty %}
|
|
<div class="note-links" title="{% trans %}Shared links{% endtrans %}">
|
|
{% for link in note.getLinks() %}
|
|
{% for block in handle_event('ViewLink', {'link': link, 'note': note}) %}
|
|
{{ block | raw }}
|
|
{% endfor %}
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
{% endblock note_links %}
|
|
|
|
{% block note_text %}
|
|
<div class="note-text" tabindex="0"
|
|
title="{% trans %}Main note content{% endtrans %}">
|
|
{% set paragraph_array = note.getRenderedSplit() %}
|
|
{% for paragraph in paragraph_array %}
|
|
<p>{{ paragraph | raw }}</p>
|
|
{% endfor %}
|
|
</div>
|
|
{% endblock note_text %}
|
|
|
|
{% block note_author %}
|
|
{# Microformat's h-card properties indicates a face icon is a "u-logo" #}
|
|
<a href="{{ actor_url }}" class="note-author-url u-url"
|
|
title="{% trans %}%nickname's profile{% endtrans %}">
|
|
{% if fullname is not null %}{{ fullname }}{% else %}{{ nickname }}{% endif %}
|
|
</a>
|
|
|
|
<small class="note-author-uri" title="{% trans %}Author related permalinks{% endtrans %}">
|
|
<a href="{{ actor_uri }}" class="u-url" title="{% trans %}%nickname%'s permalink {% endtrans %}">{{ mention }}</a>
|
|
</small>
|
|
{% endblock note_author %}
|
|
|
|
{% block note_sidebar %}
|
|
<aside class="note-sidebar" title="{% trans %}%nickname%'s avatar{% endtrans %}">
|
|
{% set actor_avatar_dimensions = actor.getAvatarDimensions() %}
|
|
<img class="u-logo avatar" src="{{ note.getActorAvatarUrl() }}"
|
|
alt="{% trans %}%nickname%'s avatar{% endtrans %}"
|
|
width="{{ actor_avatar_dimensions['width'] }}"
|
|
height="{{ actor_avatar_dimensions['height'] }}">
|
|
</aside>
|
|
{% endblock note_sidebar %}
|
|
|
|
{% block note_info %}
|
|
<header class="note-info" title="{% trans %}Information about note's author{% endtrans %}">
|
|
{{ block('note_author') }}
|
|
<small class="note-conversation-info" title="{% trans %}Conversation related permalinks{% endtrans %}">
|
|
<a href="{{ note.getConversationUrl() ~ '#' ~ note_anchor }}"
|
|
title="{% trans %}Conversation's permalink{% endtrans %}"
|
|
class="note-conversation-url">{% trans %}in conversation{% endtrans %}</a>
|
|
<a href="{{ note.getUrl() }}"
|
|
title="{% trans %}Note's permalink{% endtrans %}"
|
|
class="note-url">{{ note.getModified() | ago }}</a>
|
|
</small>
|
|
</header>
|
|
{% endblock note_info %}
|
|
|
|
{% block note_context %}
|
|
{% set attentions = note.getAttentionTargets() %}
|
|
{% if attentions is not empty %}
|
|
{% for target in attentions %}
|
|
{% 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 %}The recipient to whom this note was addressed to{% endtrans %}">
|
|
{% set mentionAnchor %}<a href="{{ target.getUrl() }}">{{ mention(target) | raw }}</a>{% endset %}
|
|
{% trans %}to %mentionAnchor%{% endtrans %}
|
|
</em>
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% set reply_to = note.getReplyTo() %}
|
|
{% if reply_to is not empty %}
|
|
<em tabindex="0"
|
|
class="note-replies-parent"
|
|
title="{% trans %}Whom this is a reply to{% endtrans %}"
|
|
aria-flowto="note-anchor-{{ reply_to }}">
|
|
{% set replyAnchor %}<a href="{{ note.getConversationUrl() ~ "#note-anchor-" ~ reply_to }}">{% endset %}
|
|
{% set target = note.getActor() %}
|
|
{% set mentionAnchor %}<a href="{{ target.getUrl() }}">{{ mention(target) | raw }}</a>{% endset %}
|
|
{% trans %}%replyAnchor% in reply to %mentionAnchor%{% endtrans %}
|
|
</em>
|
|
{% endif %}
|
|
{% endblock note_context %}
|
|
|
|
{% block note_complementary %}
|
|
{% set complementary_info_array = handle_event('AppendCardNote', { 'note': note, 'request': app.request }) %}
|
|
|
|
{% if app.user is not null or complementary_info_array is not empty %}
|
|
<aside
|
|
title="{% trans %}Additional note context information and actions{% endtrans %}"
|
|
class="note-complementary">
|
|
{% if complementary_info_array is not empty %}
|
|
<div class="note-complementary-info">
|
|
{% for complementary_info in complementary_info_array %}
|
|
{% set formatted = [] %}
|
|
{% 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>
|
|
{{ trans(
|
|
[
|
|
"{formatted} has {action} this note",
|
|
"{formatted} have {action} this note"
|
|
],
|
|
{
|
|
'count': formatted|length,
|
|
'formatted': trans_list(formatted),
|
|
'action': complementary_info['action']
|
|
}
|
|
) | raw }}
|
|
</span>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{{ block('note_actions', 'cards/blocks/note.html.twig') }}
|
|
</aside>
|
|
{% endif %}
|
|
{% endblock note_complementary %}
|