From 4c6eb51ae2ce6d84d78efe0dce02411996f78034 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Sun, 20 Nov 2022 11:12:34 +0100 Subject: [PATCH] Proper mf2 for replies --- app/main.py | 1 + app/templates/object.html | 9 +++++++-- app/templates/utils.html | 6 +++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/main.py b/app/main.py index 31c6f10..d0063dc 100644 --- a/app/main.py +++ b/app/main.py @@ -856,6 +856,7 @@ def _merge_replies( reply_tree_node.children = sorted( reply_tree_node.children + webmention_replies, key=lambda node: node.published_at, + reverse=True, ) return reply_tree_node diff --git a/app/templates/object.html b/app/templates/object.html index 12e2ff5..6d4f920 100644 --- a/app/templates/object.html +++ b/app/templates/object.html @@ -31,12 +31,15 @@ {% macro display_replies_tree(replies_tree_node) %} {% 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 %} {% 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) }} {% else %} - {{ utils.display_object(replies_tree_node.ap_object) }} +
+ {{ utils.display_object(replies_tree_node.ap_object, is_h_entry=False) }} +
{% endif %} {% endif %} @@ -46,6 +49,8 @@ {% endmacro %} +
{{ display_replies_tree(replies_tree) }} +
{% endblock %} diff --git a/app/templates/utils.html b/app/templates/utils.html index 3926177..425a5e5 100644 --- a/app/templates/utils.html +++ b/app/templates/utils.html @@ -444,7 +444,7 @@ {% macro display_webmention_reply(wm_reply) %} {% block display_webmention_reply scoped %} -
+
{{ wm_reply.face.name }}'s avatar @@ -480,11 +480,11 @@ {% endblock %} {% 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 %} {% 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 is_article_mode %}