forked from forks/microblog.pub
Proper mf2 for replies
This commit is contained in:
parent
d36102255f
commit
4c6eb51ae2
3 changed files with 11 additions and 5 deletions
|
@ -856,6 +856,7 @@ def _merge_replies(
|
||||||
reply_tree_node.children = sorted(
|
reply_tree_node.children = sorted(
|
||||||
reply_tree_node.children + webmention_replies,
|
reply_tree_node.children + webmention_replies,
|
||||||
key=lambda node: node.published_at,
|
key=lambda node: node.published_at,
|
||||||
|
reverse=True,
|
||||||
)
|
)
|
||||||
return reply_tree_node
|
return reply_tree_node
|
||||||
|
|
||||||
|
|
|
@ -31,12 +31,15 @@
|
||||||
{% macro display_replies_tree(replies_tree_node) %}
|
{% macro display_replies_tree(replies_tree_node) %}
|
||||||
|
|
||||||
{% if replies_tree_node.is_requested %}
|
{% if replies_tree_node.is_requested %}
|
||||||
{{ utils.display_object(replies_tree_node.ap_object, likes=likes, shares=shares, webmentions=webmentions, expanded=not replies_tree_node.is_root, is_object_page=True) }}
|
{{ utils.display_object(replies_tree_node.ap_object, likes=likes, shares=shares, webmentions=webmentions, expanded=not replies_tree_node.is_root, is_object_page=True, is_h_entry=False) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if replies_tree_node.wm_reply %}
|
{% if replies_tree_node.wm_reply %}
|
||||||
|
{# u-comment h-cite is displayed by default for webmention #}
|
||||||
{{ utils.display_webmention_reply(replies_tree_node.wm_reply) }}
|
{{ utils.display_webmention_reply(replies_tree_node.wm_reply) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ utils.display_object(replies_tree_node.ap_object) }}
|
<div class="u-comment h-cite">
|
||||||
|
{{ utils.display_object(replies_tree_node.ap_object, is_h_entry=False) }}
|
||||||
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@ -46,6 +49,8 @@
|
||||||
|
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
<div class="h-entry">
|
||||||
{{ display_replies_tree(replies_tree) }}
|
{{ display_replies_tree(replies_tree) }}
|
||||||
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -444,7 +444,7 @@
|
||||||
{% macro display_webmention_reply(wm_reply) %}
|
{% macro display_webmention_reply(wm_reply) %}
|
||||||
{% block display_webmention_reply scoped %}
|
{% block display_webmention_reply scoped %}
|
||||||
|
|
||||||
<div class="ap-object">
|
<div class="ap-object u-comment h-cite">
|
||||||
<div class="actor-box h-card p-author">
|
<div class="actor-box h-card p-author">
|
||||||
<div class="icon-box">
|
<div class="icon-box">
|
||||||
<img src="{{ wm_reply.face.picture_url }}" alt="{{ wm_reply.face.name }}'s avatar" class="actor-icon u-photo">
|
<img src="{{ wm_reply.face.picture_url }}" alt="{{ wm_reply.face.name }}'s avatar" class="actor-icon u-photo">
|
||||||
|
@ -480,11 +480,11 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro display_object(object, likes=[], shares=[], webmentions=[], expanded=False, actors_metadata={}, is_object_page=False) %}
|
{% macro display_object(object, likes=[], shares=[], webmentions=[], expanded=False, actors_metadata={}, is_object_page=False, is_h_entry=True) %}
|
||||||
{% block display_object scoped %}
|
{% block display_object scoped %}
|
||||||
{% set is_article_mode = object.is_from_outbox and object.ap_type == "Article" and is_object_page %}
|
{% set is_article_mode = object.is_from_outbox and object.ap_type == "Article" and is_object_page %}
|
||||||
{% if object.ap_type in ["Note", "Article", "Video", "Page", "Question", "Event"] %}
|
{% if object.ap_type in ["Note", "Article", "Video", "Page", "Question", "Event"] %}
|
||||||
<div class="ap-object {% if expanded %}ap-object-expanded {% endif %}h-entry" id="{{ object.permalink_id }}">
|
<div class="ap-object {% if expanded %}ap-object-expanded {% endif %}{% if is_h_entry %}h-entry{% endif %}" id="{{ object.permalink_id }}">
|
||||||
|
|
||||||
{% if is_article_mode %}
|
{% if is_article_mode %}
|
||||||
<data class="h-card">
|
<data class="h-card">
|
||||||
|
|
Loading…
Reference in a new issue