mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-15 03:04:28 +00:00
Also display boost/announce actors
This commit is contained in:
parent
8027a36359
commit
8e645c6190
3 changed files with 35 additions and 10 deletions
10
app.py
10
app.py
|
@ -474,7 +474,15 @@ def note_by_id(note_id):
|
||||||
}))
|
}))
|
||||||
likes = [ACTOR_SERVICE.get(doc['activity']['actor']) for doc in likes]
|
likes = [ACTOR_SERVICE.get(doc['activity']['actor']) for doc in likes]
|
||||||
|
|
||||||
return render_template('note.html', likes=likes, me=ME, thread=thread, note=data)
|
shares = list(DB.inbox.find({
|
||||||
|
'meta.undo': False,
|
||||||
|
'type': ActivityType.ANNOUNCE.value,
|
||||||
|
'$or': [{'activity.object.id': data['activity']['object']['id']},
|
||||||
|
{'activity.object': data['activity']['object']['id']}],
|
||||||
|
}))
|
||||||
|
shares = [ACTOR_SERVICE.get(doc['activity']['actor']) for doc in shares]
|
||||||
|
|
||||||
|
return render_template('note.html', likes=likes, shares=shares, me=ME, thread=thread, note=data)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/nodeinfo')
|
@app.route('/nodeinfo')
|
||||||
|
|
|
@ -16,6 +16,6 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div id="container">
|
<div id="container">
|
||||||
{% include "header.html" %}
|
{% include "header.html" %}
|
||||||
{{ utils.display_thread(thread, likes) }}
|
{{ utils.display_thread(thread, likes=likes, shares=shares) }}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
</a>
|
</a>
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
{% macro display_note(item, perma=False, ui=False, likes=[]) -%}
|
{% macro display_note(item, perma=False, ui=False, likes=[], shares=[]) -%}
|
||||||
{% set actor = item.activity.object.attributedTo | get_actor %}
|
{% set actor = item.activity.object.attributedTo | get_actor %}
|
||||||
<div class="note h-entry" id="activity-{{ item['_id'].__str__() }}">
|
<div class="note h-entry" id="activity-{{ item['_id'].__str__() }}">
|
||||||
|
|
||||||
|
@ -76,12 +76,14 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="bottom-bar">
|
<div class="bottom-bar">
|
||||||
{% if perma %}<span class="perma-item">{{ item.activity.object.published | format_time }}</span> {% endif %}
|
{% if perma %}<span class="perma-item">{{ item.activity.object.published | format_time }}</span>
|
||||||
|
{% else %}
|
||||||
<a class ="bar-item" href="{{ item.activity.object.url }}">permalink</a>
|
<a class ="bar-item" href="{{ item.activity.object.url }}">permalink</a>
|
||||||
|
|
||||||
{% if item.meta.count_reply %}<a class ="bar-item" href="{{ item.activity.object.url }}">{{ item.meta.count_reply }} replies</a>{% endif %}
|
{% if item.meta.count_reply %}<a class ="bar-item" href="{{ item.activity.object.url }}">{{ item.meta.count_reply }} replies</a>{% endif %}
|
||||||
{% if item.meta.count_boost %}<a class ="bar-item" href="{{ item.activity.object.url }}">{{ item.meta.count_boost }} boosts</a>{% endif %}
|
{% if item.meta.count_boost %}<a class ="bar-item" href="{{ item.activity.object.url }}">{{ item.meta.count_boost }} boosts</a>{% endif %}
|
||||||
{% if item.meta.count_like %}<a class ="bar-item" href="{{ item.activity.object.url }}">{{ item.meta.count_like }} likes</a>{% endif %}
|
{% if item.meta.count_like %}<a class ="bar-item" href="{{ item.activity.object.url }}">{{ item.meta.count_like }} likes</a>{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if ui and session.logged_in %}
|
{% if ui and session.logged_in %}
|
||||||
|
|
||||||
|
@ -124,23 +126,38 @@
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
{% if likes or shares %}
|
||||||
|
<div style="padding-top:20px;" class="pure-g">
|
||||||
{% if likes %}
|
{% if likes %}
|
||||||
<div style="padding-bottom:40px;">
|
<div class="pure-u-1-2">
|
||||||
<h4 style="font-weight:normal">Liked by</h4>{% for like in likes %}
|
<h4 style="font-weight:normal"><strong>{{ item.meta.count_like }}</strong> likes</h4>{% for like in likes %}
|
||||||
{{ display_actor_inline(like) }}
|
{{ display_actor_inline(like) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if shares %}
|
||||||
|
<div class="pure-u-1-2">
|
||||||
|
<h4 style="font-weight:normal"><strong>{{ item.meta.count_boost }}</strong> boosts</h4>{% for boost in shares %}
|
||||||
|
{{ display_actor_inline(boost) }}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
{% macro display_thread(thread, likes=[]) -%}
|
{% macro display_thread(thread, likes=[], shares=[]) -%}
|
||||||
{% for reply in thread %}
|
{% for reply in thread %}
|
||||||
{% if reply._requested %}
|
{% if reply._requested %}
|
||||||
{{ display_note(reply, perma=True, ui=False, likes=likes) }}
|
{{ display_note(reply, perma=True, ui=False, likes=likes, shares=shares) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ display_note(reply, perma=False, ui=True) }}
|
{{ display_note(reply, perma=False, ui=True) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Reference in a new issue