forked from forks/microblog.pub
Fix template and improve threads
This commit is contained in:
parent
1ab8920df8
commit
3a141795e6
2 changed files with 29 additions and 3 deletions
|
@ -142,7 +142,9 @@ def _get_ip():
|
||||||
def _build_thread(data, include_children=True): # noqa: C901
|
def _build_thread(data, include_children=True): # noqa: C901
|
||||||
data["_requested"] = True
|
data["_requested"] = True
|
||||||
app.logger.info(f"_build_thread({data!r})")
|
app.logger.info(f"_build_thread({data!r})")
|
||||||
root_id = data["meta"][MetaKey.OBJECT_ID.value]
|
root_id = data["meta"].get(
|
||||||
|
MetaKey.THREAD_ROOT_PARENT.value, data["meta"][MetaKey.OBJECT_ID.value]
|
||||||
|
)
|
||||||
|
|
||||||
replies = [data]
|
replies = [data]
|
||||||
for dat in find_activities(
|
for dat in find_activities(
|
||||||
|
|
|
@ -15,6 +15,17 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
|
{% macro display_actor_oneline(follower) -%}
|
||||||
|
{% if follower and follower.id %}
|
||||||
|
<span class="actor-inline">
|
||||||
|
<a href="{{follower | url_or_id | get_url }}" style="clear:both;">
|
||||||
|
{{ (follower.name or follower.preferredUsername) | clean | replace_custom_emojis(follower) | safe }}
|
||||||
|
<small class="lcolor">@{{ follower.preferredUsername }}@{{ follower | url_or_id | get_url | domain }}</small>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
|
{%- endmacro %}
|
||||||
|
|
||||||
{% macro display_note(obj, perma=False, ui=False, likes=[], shares=[], meta={}, no_color=False) -%}
|
{% macro display_note(obj, perma=False, ui=False, likes=[], shares=[], meta={}, no_color=False) -%}
|
||||||
|
|
||||||
{% if meta.object_actor %}
|
{% if meta.object_actor %}
|
||||||
|
@ -60,11 +71,22 @@
|
||||||
{% if not perma %}
|
{% if not perma %}
|
||||||
<span style="float:right;width: 25%;text-align: right;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;display: block;">
|
<span style="float:right;width: 25%;text-align: right;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;display: block;">
|
||||||
<a rel="noopener" class="u-url u-uid note-permalink l" href="{{ obj | url_or_id | get_url }}">
|
<a rel="noopener" class="u-url u-uid note-permalink l" href="{{ obj | url_or_id | get_url }}">
|
||||||
<time class="dt-published" title="{{ obj.published }}" datetime="{{ obj.published }}" {% if obj | url_or_id | is_from_outbox %}{%else%}rel="external noreferrer"{%endif%}>{{ obj.published | format_timeago }}</time></a>
|
<time class="dt-published" title="{{ obj.published }}" datetime="{{ obj.published }}" {% if obj | url_or_id | get_url | is_from_outbox %}{%else%}rel="external noreferrer"{%endif%}>{{ obj.published | format_timeago }}</time></a>
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if meta.in_reply_to_actor %}
|
||||||
|
<div style="margin:10px 0 15px 0;padding:0;">
|
||||||
|
<a href="{{ obj.inReplyTo }}">in reply to</a> {{ display_actor_oneline(meta.in_reply_to_actor) }}
|
||||||
|
</div>
|
||||||
|
{% elif meta.in_reply_to_self %}
|
||||||
|
<div style="margin:10px 0 15px 0;padding:0;">
|
||||||
|
self reply
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
{% if obj.summary %}<p class="p-summary">{{ obj.summary | clean | replace_custom_emojis(obj) | safe }}</p>{% endif %}
|
{% if obj.summary %}<p class="p-summary">{{ obj.summary | clean | replace_custom_emojis(obj) | safe }}</p>{% endif %}
|
||||||
{% if obj | has_type('Video') %}
|
{% if obj | has_type('Video') %}
|
||||||
<div class="note-video">
|
<div class="note-video">
|
||||||
|
@ -321,7 +343,9 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if meta.object_visibility | visibility_is_public %}
|
{% if meta.object_visibility | visibility_is_public %}
|
||||||
{% if obj | url_or_id | is_from_outbox %}
|
{% if obj.inReplyTo and not meta.count_reply and not perma %}
|
||||||
|
<a class="bar-item" href="/admin/thread?oid={{aid}}">thread</a>{% endif %}
|
||||||
|
{% if obj | url_or_id | get_url | is_from_outbox %}
|
||||||
<a class="bar-item" href="{{ obj | url_or_id | get_url }}">permalink</a>
|
<a class="bar-item" href="{{ obj | url_or_id | get_url }}">permalink</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a class="bar-item" href="{{ obj | url_or_id | get_url }}" rel="external noreferrer">source</a>
|
<a class="bar-item" href="{{ obj | url_or_id | get_url }}" rel="external noreferrer">source</a>
|
||||||
|
|
Loading…
Reference in a new issue