2018-06-23 10:01:31 +00:00
|
|
|
{% macro display_actor_inline(follower, size=50) -%}
|
2018-07-22 10:53:09 +00:00
|
|
|
{% if follower and follower.id %}
|
2018-07-22 10:42:36 +00:00
|
|
|
<a class="actor-box" href="{{follower | url_or_id | get_url }}" style="clear:both;">
|
2018-06-03 21:11:43 +00:00
|
|
|
<span style="float:left;padding-right:15px;">
|
|
|
|
{% if not follower.icon %}
|
2018-06-23 10:01:31 +00:00
|
|
|
<img class="actor-icon" src="/static/nopic.png" style="width:{{ size }}px">
|
2018-06-03 21:11:43 +00:00
|
|
|
{% else %}
|
2018-07-04 23:08:39 +00:00
|
|
|
<img class="actor-icon" src="{{ follower.icon.url | get_actor_icon_url(size) }}" style="width:{{ size }}px;">{% endif %}
|
2018-06-03 21:11:43 +00:00
|
|
|
</span>
|
2018-06-22 07:35:18 +00:00
|
|
|
<div class="actor-inline">
|
2019-08-20 20:16:47 +00:00
|
|
|
<div style="font-weight:bold">{{ (follower.name or follower.preferredUsername) | clean | replace_custom_emojis(follower) | safe }}</div>
|
2018-07-22 10:42:36 +00:00
|
|
|
<small class="lcolor">@{{ follower.preferredUsername }}@{{ follower | url_or_id | get_url | domain }}</small>
|
2018-06-03 21:11:43 +00:00
|
|
|
</div>
|
|
|
|
</a>
|
2018-07-22 10:53:09 +00:00
|
|
|
{% endif %}
|
2018-06-03 21:11:43 +00:00
|
|
|
{%- endmacro %}
|
|
|
|
|
2019-10-27 09:42:52 +00:00
|
|
|
{% macro display_actor_icon(follower, size=50) -%}
|
|
|
|
{% if follower and follower.id %}
|
|
|
|
<a href="{{follower | url_or_id | get_url }}" style="width:65px;padding-left:15px;padding-bottom:15px;text-decoration:none;padding:0;margin:0;height:65px;">
|
|
|
|
{% if not follower.icon %}
|
|
|
|
<img class="actor-icon" title="@{{ follower.preferredUsername }}@{{ follower | url_or_id | get_url | domain }}" src="/static/nopic.png" style="width:{{ size }}px;border-radius:2px;margin:0;padding:0">
|
|
|
|
{% else %}
|
|
|
|
<img class="actor-icon" title="@{{ follower.preferredUsername }}@{{ follower | url_or_id | get_url | domain }}" src="{{ follower.icon.url | get_actor_icon_url(size) }}" style="width:{{ size }}px;border-radius:2px;">{% endif %}
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
{%- endmacro %}
|
|
|
|
|
2019-09-01 12:19:33 +00:00
|
|
|
{% 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 %}
|
|
|
|
|
2019-10-20 13:29:58 +00:00
|
|
|
{% macro display_actor_box(actor, after=None, before=None, before_url=None) -%}
|
|
|
|
|
|
|
|
{% if not actor.icon %}
|
|
|
|
{% set icon_url = "/static/nopic.png" %}
|
|
|
|
{% else %}
|
|
|
|
{% set icon_url = actor.icon.url | get_actor_icon_url(50) %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<span class="bar-item-no-hover" style="padding:0;">
|
|
|
|
<span style="display:flex;height:30px;line-height:30px;background: url('{{ icon_url }}') no-repeat;background-size:30px;border-top-left-radius: 2px;border-bottom-left-radius: 2px;">
|
|
|
|
{% if before and before_url %}
|
|
|
|
<span style="flex-shrink:1; padding:0 10px 0 40px;"><a href="{{before_url}}">{{before}}</a></span>
|
|
|
|
<span style="flex-shrink:1;padding-right:10px;">
|
|
|
|
<a style="color:#808080;" href="{{ actor.url | get_url }}">{{ ( actor.name or actor.preferredUsername) | clean | replace_custom_emojis(actor) | safe }}</a>
|
|
|
|
</span>
|
|
|
|
{% endif %}
|
|
|
|
{% if after %}
|
|
|
|
<span style="flex-shrink:1;padding-left:40px;">
|
|
|
|
<a style="color:#808080;" href="{{ actor.url | get_url }}">{{ ( actor.name or actor.preferredUsername) | clean | replace_custom_emojis(actor) | safe }}</a>
|
|
|
|
</span>
|
|
|
|
<span style="flex-shrink:1;padding:0 10px;">{{ after }}</span>
|
|
|
|
{% endif %}
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
{%- endmacro %}
|
|
|
|
|
|
|
|
{% macro display_in_reply_to(meta, obj) -%}
|
|
|
|
|
|
|
|
{% if meta.in_reply_to_actor %}
|
|
|
|
{{ display_actor_box(meta.in_reply_to_actor, before="in reply to", before_url=obj.inReplyTo) }}
|
|
|
|
{% elif meta.in_reply_to_self %}
|
2019-10-20 14:00:02 +00:00
|
|
|
<span class="bar-item-no-hover">
|
2019-10-20 13:29:58 +00:00
|
|
|
<a href="{{ obj.inReplyTo }}">self reply</a>
|
|
|
|
</span>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{%- endmacro %}
|
|
|
|
|
2019-10-02 20:34:38 +00:00
|
|
|
{% macro display_note(obj, perma=False, likes=[], shares=[], meta={}, no_color=False) -%}
|
2019-04-15 19:20:14 +00:00
|
|
|
|
2019-07-15 21:08:12 +00:00
|
|
|
{% if meta.object_actor %}
|
|
|
|
{% set actor = meta.object_actor %}
|
|
|
|
{% elif meta.actor %}
|
2019-04-15 19:20:14 +00:00
|
|
|
{% set actor = meta.actor %}
|
2018-07-19 23:12:02 +00:00
|
|
|
{% else %}
|
2019-04-15 19:20:14 +00:00
|
|
|
{% set actor = obj.attributedTo | get_actor %}
|
2018-07-19 23:12:02 +00:00
|
|
|
{% endif %}
|
2018-07-29 18:24:46 +00:00
|
|
|
|
2019-04-14 17:17:54 +00:00
|
|
|
|
|
|
|
{% if session.logged_in %}
|
2019-04-15 19:20:14 +00:00
|
|
|
{% set perma_id = obj.id | permalink_id %}
|
2019-04-14 17:17:54 +00:00
|
|
|
|
2019-04-15 19:20:14 +00:00
|
|
|
{% if request.args.get('older_than') %}
|
|
|
|
{% set redir = request.path + "?older_than=" + request.args.get('older_than') + "#activity-" + perma_id %}
|
|
|
|
{% elif request.args.get('newer_than') %}
|
|
|
|
{% set redir = request.path + "?newer_than=" + request.args.get('newer_than') + "#activity-" + perma_id %}
|
|
|
|
{% else %}
|
|
|
|
{% set redir = request.path + "#activity-" + perma_id %}
|
|
|
|
{% endif %}
|
2019-04-14 17:17:54 +00:00
|
|
|
|
2019-04-15 19:20:14 +00:00
|
|
|
{% set aid = obj.id | quote_plus %}
|
|
|
|
{% endif %}
|
2019-04-14 17:17:54 +00:00
|
|
|
|
2019-06-29 09:33:29 +00:00
|
|
|
{% set real_end_time = obj.closed or obj.endTime %}
|
2019-04-14 17:17:54 +00:00
|
|
|
|
2019-09-08 08:56:46 +00:00
|
|
|
<article class="note-box">
|
2018-06-29 20:16:26 +00:00
|
|
|
<div class="note h-entry" id="activity-{{ obj.id | permalink_id }}">
|
2018-05-18 18:41:41 +00:00
|
|
|
|
|
|
|
<div class="h-card p-author">
|
2019-09-08 08:56:46 +00:00
|
|
|
<a class="u-url u-uid no-hover" rel="author" href="{{ actor | url_or_id | get_url }}"><img class="u-photo" src="{% if not actor.icon %}/static/nopic.png{% else %}{{ actor.icon.url | get_actor_icon_url(50) }}{% endif %}">
|
2018-05-18 18:41:41 +00:00
|
|
|
</a>
|
2018-06-25 21:45:43 +00:00
|
|
|
<data class="p-name" value="{{ actor.name or actor.preferredUsername }}"></data>
|
2018-05-18 18:41:41 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="note-wrapper">
|
2019-09-08 08:56:46 +00:00
|
|
|
<aside style="clear:both;height:20px;">
|
2019-08-20 20:16:47 +00:00
|
|
|
<a href="{{ actor | url_or_id | get_url }}" style="margin:0;text-decoration:none;margin: 0;text-decoration: none;display: block;width: 75%;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;float: left;" class="no-hover">
|
|
|
|
<strong>{{ (actor.name or actor.preferredUsername) | clean | replace_custom_emojis(actor) | safe }}</strong>
|
|
|
|
<span class="l">@{% if not no_color and obj.id | is_from_outbox %}<span class="pcolor">{{ actor.preferredUsername | clean | replace_custom_emojis(actor) | safe }}</span>{% else %}{{ actor.preferredUsername | clean | replace_custom_emojis(actor) | safe }}{% endif %}@{% if not no_color and obj.id | is_from_outbox %}<span class="pcolor">{{ actor | url_or_id | get_url | domain }}</span>{% else %}{{ actor | url_or_id | get_url | domain }}{% endif %}</span></a>
|
2018-05-18 18:41:41 +00:00
|
|
|
|
2019-07-15 21:08:12 +00:00
|
|
|
<span style="float:right;width: 25%;text-align: right;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;display: block;">
|
2018-07-30 07:41:04 +00:00
|
|
|
<a rel="noopener" class="u-url u-uid note-permalink l" href="{{ obj | url_or_id | get_url }}">
|
2019-09-01 12:19:33 +00:00
|
|
|
<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>
|
2018-05-18 18:41:41 +00:00
|
|
|
</span>
|
2019-09-08 08:56:46 +00:00
|
|
|
</aside>
|
2019-04-15 19:20:14 +00:00
|
|
|
|
2019-08-20 20:16:47 +00:00
|
|
|
{% if obj.summary %}<p class="p-summary">{{ obj.summary | clean | replace_custom_emojis(obj) | safe }}</p>{% endif %}
|
2018-09-02 17:43:09 +00:00
|
|
|
{% if obj | has_type('Video') %}
|
|
|
|
<div class="note-video">
|
2019-08-11 12:58:09 +00:00
|
|
|
<video controls preload="metadata" src="{{ obj.url | get_video_url }}" width="480">
|
2018-09-02 17:43:09 +00:00
|
|
|
</video>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
2019-04-15 19:20:14 +00:00
|
|
|
<div class="note-container{% if perma %} perma{%endif%} p-name e-content">
|
2019-04-18 22:33:59 +00:00
|
|
|
{% if obj | has_type(['Article', 'Page']) %}
|
2019-04-15 19:20:14 +00:00
|
|
|
{{ obj.name }} <a href="{{ obj | url_or_id | get_url }}">{{ obj | url_or_id | get_url }}</a>
|
2019-04-09 19:32:40 +00:00
|
|
|
{% elif obj | has_type('Question') %}
|
2019-11-02 08:52:04 +00:00
|
|
|
{{ obj.content | update_inline_imgs | clean | replace_custom_emojis(obj) | code_highlight | safe }}
|
2019-04-15 19:20:14 +00:00
|
|
|
|
2019-07-04 21:22:38 +00:00
|
|
|
|
2019-04-15 19:20:14 +00:00
|
|
|
<ul style="list-style:none;padding:0;">
|
2019-07-02 20:25:07 +00:00
|
|
|
{% set total_votes = obj | get_total_answers_count(meta) %}
|
2019-04-15 19:20:14 +00:00
|
|
|
{% for oneOf in obj.oneOf %}
|
|
|
|
{% set pct = 0 %}
|
|
|
|
{% if total_votes > 0 %}
|
2019-07-02 20:25:07 +00:00
|
|
|
{% set cnt = oneOf.name | get_answer_count(obj, meta) %}
|
2019-04-15 19:20:14 +00:00
|
|
|
{% set pct = cnt * 100.0 / total_votes %}
|
|
|
|
{% endif %}
|
|
|
|
<li class="answer">
|
2019-08-15 12:47:41 +00:00
|
|
|
{% if session.logged_in and not meta.poll_answers_sent and not (real_end_time | gtnow) and not (obj.id | is_from_outbox) %}
|
2019-07-04 21:22:38 +00:00
|
|
|
<span><form action="/api/vote" class="action-form" method="POST">
|
|
|
|
<input type="hidden" name="redirect" value="{{ redir }}">
|
|
|
|
<input type="hidden" name="id" value="{{ obj.id }}">
|
|
|
|
<input type="hidden" name="choice" value="{{ oneOf.name }}">
|
|
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
|
|
<button type="submit" class="bar-item">vote</button>
|
|
|
|
</form></span>{% endif %}
|
|
|
|
|
2019-04-15 19:20:14 +00:00
|
|
|
<span class="answer-bar color-menu-background" style="width:{{pct}}%;"></span>
|
|
|
|
<span class="answer-text">
|
|
|
|
<span>{{ '%0.0f'| format(pct) }}%</span>
|
2019-08-15 12:47:41 +00:00
|
|
|
{{ oneOf.name }} {% if oneOf.name | poll_answer_key in meta.poll_answers_sent %}(your vote){% endif %}
|
2019-04-15 19:20:14 +00:00
|
|
|
</span>
|
|
|
|
</li>
|
|
|
|
{% endfor %}
|
2019-08-15 12:47:41 +00:00
|
|
|
{% if obj.anyOf %}
|
|
|
|
|
|
|
|
{% for anyOf in obj.anyOf %}
|
|
|
|
{% set pct = 0 %}
|
|
|
|
{% if total_votes > 0 %}
|
|
|
|
{% set cnt = anyOf.name | get_answer_count(obj, meta) %}
|
|
|
|
{% set pct = cnt * 100.0 / total_votes %}
|
|
|
|
{% endif %}
|
|
|
|
<li class="answer">
|
|
|
|
{% set already_voted = anyOf.name | poll_answer_key in meta.poll_answers_sent %}
|
|
|
|
{% if session.logged_in and not already_voted and not (real_end_time | gtnow) and not (obj.id | is_from_outbox) %}
|
|
|
|
<span><form action="/api/vote" class="action-form" method="POST">
|
|
|
|
<input type="hidden" name="redirect" value="{{ redir }}">
|
|
|
|
<input type="hidden" name="id" value="{{ obj.id }}">
|
|
|
|
<input type="hidden" name="choice" value="{{ anyOf.name }}">
|
|
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
|
|
<button type="submit" class="bar-item">vote</button>
|
|
|
|
</form></span>
|
2019-08-15 12:56:32 +00:00
|
|
|
{% elif session.logged_in and already_voted and not (real_end_time | gtnow) %}
|
2019-08-15 12:47:41 +00:00
|
|
|
<span style="position:relative;top:5px;height:10px;width:50px;display:inline-block;"></span>
|
|
|
|
{% endif %}
|
|
|
|
<span class="answer-bar color-menu-background" style="width:{{pct}}%;"></span>
|
|
|
|
<span class="answer-text">
|
|
|
|
<span>{{ '%0.0f'| format(pct) }}%</span>
|
|
|
|
{{ anyOf.name }} {% if anyOf.name | poll_answer_key in meta.poll_answers_sent %}(your vote){% endif %}
|
|
|
|
</span>
|
|
|
|
</li>
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
{% endif %}
|
2019-04-14 17:17:54 +00:00
|
|
|
</ul>
|
|
|
|
<p><small>
|
2019-06-29 09:33:29 +00:00
|
|
|
{% if real_end_time | gtnow %}
|
2019-07-02 20:25:07 +00:00
|
|
|
Ended {{ real_end_time | format_timeago }} with <strong>{{ total_votes }}</strong> vote{% if total_votes | gtone %}s{% endif %}.
|
2019-04-14 17:17:54 +00:00
|
|
|
{% else %}
|
2019-07-02 20:25:07 +00:00
|
|
|
Ends {{ real_end_time | format_timeago }} (<strong>{{ total_votes }}</strong> vote{% if total_votes | gtone %}s{% endif %} as of now).
|
2019-04-14 17:17:54 +00:00
|
|
|
{% endif %}
|
|
|
|
</small></p>
|
|
|
|
|
|
|
|
|
2018-07-29 18:24:46 +00:00
|
|
|
{% else %}
|
2019-11-02 08:52:04 +00:00
|
|
|
{{ obj.content | update_inline_imgs | clean | replace_custom_emojis(obj) | code_highlight | safe }}
|
2018-07-29 18:24:46 +00:00
|
|
|
{% endif %}
|
2019-10-27 18:05:42 +00:00
|
|
|
|
|
|
|
{% if obj | has_place %}
|
|
|
|
<p>Location: {{ obj | get_place | safe }}</p>
|
|
|
|
{% endif %}
|
|
|
|
|
2018-05-18 18:41:41 +00:00
|
|
|
</div>
|
|
|
|
|
2018-07-29 18:24:46 +00:00
|
|
|
{% if obj.attachment and obj | has_type('Note') %}
|
2018-05-18 18:41:41 +00:00
|
|
|
<div style="padding:20px 0;">
|
2019-08-15 15:09:17 +00:00
|
|
|
|
|
|
|
{% if obj.sensitive and not request.args.get("show_sensitive") == perma_id %}
|
|
|
|
<div style="clear:both">
|
|
|
|
<form action="{{redir}}" class="action-form" method="GET" style="display:inline-block">
|
|
|
|
<input type="hidden" name="show_sensitive" value="{{perma_id}}">
|
2019-08-16 10:04:23 +00:00
|
|
|
{% if request.path == url_for("admin.admin_lookup") %}
|
2019-08-15 15:09:17 +00:00
|
|
|
<input type="hidden" name="url" value="{{obj.id}}">
|
2019-08-16 10:04:23 +00:00
|
|
|
{% endif %}
|
2019-08-15 15:09:17 +00:00
|
|
|
<button type="submit" class="bar-item-reverse">display sensitive content</button>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
|
2019-08-16 10:04:23 +00:00
|
|
|
{% if obj.sensitive %}
|
|
|
|
<div style="clear:both;margin-bottom: 20px;">
|
|
|
|
<form action="{{redir}}" class="action-form" method="GET" style="display:inline-block">
|
|
|
|
{% if request.path == url_for("admin.admin_lookup") %}
|
|
|
|
<input type="hidden" name="url" value="{{obj.id}}">
|
|
|
|
{% endif %}
|
2019-08-16 12:42:15 +00:00
|
|
|
<button type="submit" class="bar-item">hide sensitive content</button>
|
2019-08-16 10:04:23 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
2018-06-29 20:16:26 +00:00
|
|
|
{% if obj.attachment | not_only_imgs %}
|
2018-09-02 17:43:09 +00:00
|
|
|
<h3 class="l">Attachments</h3>
|
2019-08-23 22:19:59 +00:00
|
|
|
<ul style="padding:0;list-style-type: none;">
|
2018-05-18 18:41:41 +00:00
|
|
|
{% endif %}
|
2019-11-03 08:59:04 +00:00
|
|
|
{% for a in (obj | iter_note_attachments) %}
|
2018-07-24 20:10:39 +00:00
|
|
|
{% if (a.mediaType and a.mediaType.startswith("image/")) or (a.type and a.type == 'Image') %}
|
2019-09-05 21:16:23 +00:00
|
|
|
<a href="{{ a.url | get_attachment_url(None) }}">
|
2019-09-09 19:23:18 +00:00
|
|
|
<img src="{{a.url | get_attachment_url(720) }}" title="{{ a.name }}" alt="{{ a.name }}" class="img-attachment"></a>
|
2018-09-02 17:43:09 +00:00
|
|
|
{% elif (a.mediaType and a.mediaType.startswith("video/")) %}
|
2019-09-09 19:23:18 +00:00
|
|
|
<li><video controls preload="metadata" src="{{ a.url | get_attachment_url(None) }}" title="{{ a.name }}" width="480"></video></li>
|
2019-08-23 22:03:26 +00:00
|
|
|
{% elif (a.mediaType and a.mediaType.startswith("audio/")) %}
|
2019-09-09 19:23:18 +00:00
|
|
|
<li><audio controls preload="metadata" src="{{ a.url | get_attachment_url(None) }}" title="{{ a.name }}" style="width:480px;"></audio></li>
|
2018-05-18 18:41:41 +00:00
|
|
|
{% else %}
|
2018-07-23 21:56:22 +00:00
|
|
|
<li><a href="{{a.url }}" class="l">{% if a.filename %}{{ a.filename }}{% else %}{{ a.url }}{% endif %}</a></li>
|
2018-05-18 18:41:41 +00:00
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
2018-06-29 20:16:26 +00:00
|
|
|
{% if obj.attachment | not_only_imgs %}
|
2018-05-18 18:41:41 +00:00
|
|
|
</ul>
|
|
|
|
{% endif %}
|
2019-08-15 15:09:17 +00:00
|
|
|
|
|
|
|
{% endif %}
|
2018-05-18 18:41:41 +00:00
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
2018-07-21 21:16:40 +00:00
|
|
|
|
|
|
|
|
2018-07-29 18:24:46 +00:00
|
|
|
{% if meta and meta.og_metadata and obj | has_type('Note') %}
|
2018-07-21 21:16:40 +00:00
|
|
|
{% for og in meta.og_metadata %}
|
2018-08-05 11:55:48 +00:00
|
|
|
{% if og.url %}
|
2018-07-21 21:16:40 +00:00
|
|
|
<a href="{{ og.url }}" class="og-link" style="margin:30px 0;clear:both;display: flex;">
|
2019-10-04 22:20:13 +00:00
|
|
|
{% if og.image | get_og_image_url %}
|
2019-10-07 07:21:45 +00:00
|
|
|
<div style="padding:0 20px 0 0;">
|
2018-07-21 21:16:40 +00:00
|
|
|
<img style="width:100px;border-radius:3px;" src="{{ og.image | get_og_image_url }}">
|
|
|
|
</div>
|
2019-10-04 22:20:13 +00:00
|
|
|
{% endif %}
|
|
|
|
<div>
|
2018-07-21 21:16:40 +00:00
|
|
|
<strong>{{ og.title }}</strong>
|
|
|
|
<p>{{ og.description | truncate(80) }}</p>
|
|
|
|
<small>{{ og.site_name }}</small>
|
|
|
|
</div>
|
|
|
|
</a>
|
2018-08-05 11:55:48 +00:00
|
|
|
{% endif %}
|
2018-07-21 21:16:40 +00:00
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-09-08 08:56:46 +00:00
|
|
|
<aside class="bottom-bar">
|
2019-10-01 21:06:52 +00:00
|
|
|
{% if meta.count_reply and obj.id | is_from_outbox %}<a class ="bar-item" href="{{ obj.url | get_url }}"><strong>{{ meta.count_reply }}</strong> repl{% if meta.count_reply > 1 %}ies{% else %}y{% endif %}</a>
|
2018-07-14 10:29:46 +00:00
|
|
|
{% elif meta.count_reply and session.logged_in %}
|
2019-10-01 21:06:52 +00:00
|
|
|
<a class="bar-item" href="/admin/thread?oid={{aid}}"><strong>{{ meta.count_reply }}</strong> repl{% if meta.count_reply > 1 %}ies{% else %}y{% endif %}</a>{% endif %}
|
2019-07-15 21:08:12 +00:00
|
|
|
|
2018-07-14 10:29:46 +00:00
|
|
|
|
2019-09-30 21:05:38 +00:00
|
|
|
{% if not perma and meta.count_boost and obj.id | is_from_outbox %}<a class ="bar-item" href="{{ obj.url | get_url }}"><strong>{{ meta.count_boost }}</strong> boost{% if meta.count_boost > 1 %}s{% endif %}</a>{% endif %}
|
|
|
|
{% if not perma and meta.count_like and obj.id | is_from_outbox %}<a class ="bar-item" href="{{ obj.url | get_url }}"><strong>{{ meta.count_like }}</strong> like{% if meta.count_like > 1 %}s{% endif %}</a>{% endif %}
|
2018-07-14 10:29:46 +00:00
|
|
|
|
|
|
|
{% if session.logged_in %}
|
2019-07-15 21:08:12 +00:00
|
|
|
<a class="bar-item" href="/admin/new?reply={{ aid }}">reply</a>
|
2018-07-14 10:14:08 +00:00
|
|
|
|
2019-09-30 21:05:38 +00:00
|
|
|
{% if meta | get_visibility | visibility_is_public %}
|
2018-06-29 20:16:26 +00:00
|
|
|
{% if meta.boosted %}
|
2018-06-03 10:15:30 +00:00
|
|
|
<form action="/api/undo" class="action-form" method="POST">
|
|
|
|
<input type="hidden" name="redirect" value="{{ redir }}">
|
2018-06-29 20:16:26 +00:00
|
|
|
<input type="hidden" name="id" value="{{ meta.boosted }}">
|
2018-06-03 10:15:30 +00:00
|
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
|
|
<button type="submit" class="bar-item">unboost</button>
|
|
|
|
</form>
|
2018-05-18 18:41:41 +00:00
|
|
|
{% else %}
|
2018-06-03 10:15:30 +00:00
|
|
|
<form action="/api/boost" class="action-form" method="POST">
|
|
|
|
<input type="hidden" name="redirect" value="{{ redir }}">
|
2018-06-29 20:16:26 +00:00
|
|
|
<input type="hidden" name="id" value="{{ obj.id }}">
|
2018-06-03 10:15:30 +00:00
|
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
2019-07-15 21:08:12 +00:00
|
|
|
<button type="submit" class="bar-item">boost</button>
|
2018-06-03 10:15:30 +00:00
|
|
|
</form>
|
2018-05-18 18:41:41 +00:00
|
|
|
{% endif %}
|
2019-07-15 21:08:12 +00:00
|
|
|
{% endif %}
|
2018-05-18 18:41:41 +00:00
|
|
|
|
2018-06-29 20:16:26 +00:00
|
|
|
{% if meta.liked %}
|
2018-06-03 10:02:00 +00:00
|
|
|
<form action="/api/undo" class="action-form" method="POST">
|
|
|
|
<input type="hidden" name="redirect" value="{{ redir }}">
|
2018-06-29 20:16:26 +00:00
|
|
|
<input type="hidden" name="id" value="{{ meta.liked }}">
|
2018-06-03 10:02:00 +00:00
|
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
|
|
<button type="submit" class="bar-item">unlike</button>
|
|
|
|
</form>
|
2018-05-18 18:41:41 +00:00
|
|
|
{% else %}
|
2018-06-03 10:02:00 +00:00
|
|
|
<form action="/api/like" class="action-form" method="POST">
|
|
|
|
<input type="hidden" name="redirect" value="{{ redir }}">
|
2018-06-29 20:16:26 +00:00
|
|
|
<input type="hidden" name="id" value="{{ obj.id }}">
|
2018-06-03 10:02:00 +00:00
|
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
|
|
<button type="submit" class="bar-item">like</button>
|
|
|
|
</form>
|
2018-05-18 18:41:41 +00:00
|
|
|
{% endif %}
|
|
|
|
|
2019-08-01 17:55:30 +00:00
|
|
|
{% if meta.bookmarked or request.path == url_for("admin.admin_bookmarks") %}
|
2019-07-10 21:32:48 +00:00
|
|
|
<form action="/api/bookmark" class="action-form" method="POST">
|
|
|
|
<input type="hidden" name="redirect" value="{{ redir }}">
|
|
|
|
<input type="hidden" name="id" value="{{ obj.id }}">
|
|
|
|
<input type="hidden" name="undo" value="yes">
|
|
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
|
|
<button type="submit" class="bar-item">unbookmark</button>
|
|
|
|
</form>
|
|
|
|
{% else %}
|
|
|
|
<form action="/api/bookmark" class="action-form" method="POST">
|
|
|
|
<input type="hidden" name="redirect" value="{{ redir }}">
|
|
|
|
<input type="hidden" name="id" value="{{ obj.id }}">
|
|
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
|
|
<button type="submit" class="bar-item">bookmark</button>
|
|
|
|
</form>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
|
2018-06-04 16:53:44 +00:00
|
|
|
|
2018-06-29 20:16:26 +00:00
|
|
|
{% if obj.id | is_from_outbox %}
|
2018-06-04 16:53:44 +00:00
|
|
|
<form action="/api/note/delete" class="action-form" method="POST">
|
|
|
|
<input type="hidden" name="redirect" value="{{ redir }}">
|
2018-06-29 20:16:26 +00:00
|
|
|
<input type="hidden" name="id" value="{{ obj.id }}">
|
2018-06-04 16:53:44 +00:00
|
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
2019-07-15 21:08:12 +00:00
|
|
|
<button type="submit" class="bar-item" onclick="return confirm('Confirm the delete action?');">delete</button>
|
2018-06-04 16:53:44 +00:00
|
|
|
</form>
|
2018-07-22 20:22:30 +00:00
|
|
|
{% if meta.pinned %}
|
|
|
|
<form action="/api/note/unpin" class="action-form" method="POST">
|
|
|
|
<input type="hidden" name="redirect" value="{{ redir }}">
|
|
|
|
<input type="hidden" name="id" value="{{ obj.id }}">
|
|
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
|
|
<button type="submit" class="bar-item">unpin</button>
|
|
|
|
</form>
|
|
|
|
{% else %}
|
|
|
|
<form action="/api/note/pin" class="action-form" method="POST">
|
|
|
|
<input type="hidden" name="redirect" value="{{ redir }}">
|
|
|
|
<input type="hidden" name="id" value="{{ obj.id }}">
|
|
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
|
|
<button type="submit" class="bar-item">pin</button>
|
|
|
|
</form>
|
|
|
|
{% endif %}
|
|
|
|
|
2019-10-04 21:46:14 +00:00
|
|
|
{% endif %}
|
2019-08-25 14:02:05 +00:00
|
|
|
{% endif %}
|
2019-07-15 21:08:12 +00:00
|
|
|
|
2019-09-01 12:28:50 +00:00
|
|
|
{% if session.logged_in and obj.inReplyTo and not meta.count_reply and not perma %}
|
|
|
|
<a class="bar-item" href="/admin/thread?oid={{aid}}">thread</a>
|
|
|
|
{% endif %}
|
|
|
|
|
2019-09-30 21:05:38 +00:00
|
|
|
{% if meta | get_visibility | visibility_is_public %}
|
2019-09-01 12:19:33 +00:00
|
|
|
{% if obj | url_or_id | get_url | is_from_outbox %}
|
2019-09-07 08:35:28 +00:00
|
|
|
{% if not perma %}
|
|
|
|
<a class="bar-item" href="{{ obj | url_or_id | get_url }}">permalink</a>
|
|
|
|
{% endif %}
|
2019-08-25 19:29:07 +00:00
|
|
|
{% else %}
|
|
|
|
<a class="bar-item" href="{{ obj | url_or_id | get_url }}" rel="external noreferrer">source</a>
|
2019-08-28 21:15:01 +00:00
|
|
|
{% if session.logged_in %}
|
|
|
|
<a class="bar-item" href="/admin/profile?actor_id={{actor.id}}">profile</a>
|
|
|
|
{% endif %}
|
2019-08-25 19:29:07 +00:00
|
|
|
{% endif %}
|
2019-08-26 22:32:22 +00:00
|
|
|
{% endif %}
|
2019-09-30 21:05:38 +00:00
|
|
|
<a class="bar-item bar-item-no-border">{{ meta | get_visibility | visibility }}</a>
|
2018-06-04 16:53:44 +00:00
|
|
|
|
2019-09-08 08:56:46 +00:00
|
|
|
</aside>
|
2018-05-18 18:41:41 +00:00
|
|
|
|
2018-06-03 21:36:16 +00:00
|
|
|
{% if likes or shares %}
|
2019-10-27 09:42:52 +00:00
|
|
|
<aside style="padding-top:20px;">
|
2018-06-03 21:11:43 +00:00
|
|
|
{% if likes %}
|
2019-10-27 09:42:52 +00:00
|
|
|
<h4 style="font-weight:normal"><strong>{{ likes|length }}</strong> like{% if (likes | length) > 1 %}s{% endif %}</h4>
|
|
|
|
<div style="display:flex;flex-wrap:wrap;">
|
|
|
|
{% for like in likes %}
|
|
|
|
{{ display_actor_icon(like) }}
|
2018-06-03 21:11:43 +00:00
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2018-06-03 21:36:16 +00:00
|
|
|
{% if shares %}
|
2019-10-27 09:42:52 +00:00
|
|
|
<h4 style="font-weight:normal"><strong>{{ shares|length }}</strong> boost{% if (shares|length) > 1 %}s{% endif %}</h4>
|
|
|
|
<div style="display:flex;flex-wrap:wrap;">
|
|
|
|
{% for boost in shares %}
|
|
|
|
{{ display_actor_icon(boost) }}
|
2018-06-03 21:36:16 +00:00
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2019-09-08 08:56:46 +00:00
|
|
|
</aside>
|
2018-06-03 21:36:16 +00:00
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-09-08 08:56:46 +00:00
|
|
|
</article>
|
2018-07-21 21:16:40 +00:00
|
|
|
|
2018-06-03 21:11:43 +00:00
|
|
|
|
2018-05-18 18:41:41 +00:00
|
|
|
{%- endmacro %}
|
2018-06-03 19:28:06 +00:00
|
|
|
|
2018-06-03 21:36:16 +00:00
|
|
|
{% macro display_thread(thread, likes=[], shares=[]) -%}
|
2018-06-03 19:28:06 +00:00
|
|
|
{% for reply in thread %}
|
|
|
|
{% if reply._requested %}
|
2019-10-20 14:00:02 +00:00
|
|
|
<div style="margin-left:70px;padding-bottom:5px;margin-bottom:15px;display:inline-block;">
|
|
|
|
{{ display_in_reply_to(reply.meta, reply.activity.object) }}
|
|
|
|
</div>
|
2019-10-02 20:34:38 +00:00
|
|
|
{{ display_note(reply.activity.object, perma=True, likes=likes, shares=shares, meta=reply.meta) }}
|
2018-06-03 19:28:06 +00:00
|
|
|
{% else %}
|
2019-10-20 14:00:02 +00:00
|
|
|
<div style="margin-left:70px;padding-bottom:5px;margin-bottom:15px;display:inline-block;">
|
|
|
|
{{ display_in_reply_to(reply.meta, reply.activity.object) }}
|
|
|
|
</div>
|
2019-10-02 20:34:38 +00:00
|
|
|
{{ display_note(reply.activity.object, perma=False, meta=reply.meta) }}
|
2018-06-03 19:28:06 +00:00
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
{% endmacro -%}
|
2018-07-06 21:53:33 +00:00
|
|
|
|
|
|
|
{% macro display_pagination(older_than, newer_than) -%}
|
|
|
|
<div class="clear">
|
|
|
|
{% if older_than %}
|
2019-10-02 20:46:03 +00:00
|
|
|
<a href="{{ config.BASE_URL }}{{ request.path }}?older_than={{older_than}}{% if request.args.get('limit') %}&limit={{request.args.get('limit')}}{% endif %}{% if request.args.get('actor_id') %}&actor_id={{request.args.get('actor_id')}}{% endif %}" rel="next" class="older-link lcolor"><span class="pcolor">🡨</span> Older</a>
|
2018-07-06 21:53:33 +00:00
|
|
|
{% endif %}
|
|
|
|
{% if newer_than %}
|
2019-10-02 20:46:03 +00:00
|
|
|
<a href="{{ config.BASE_URL }}{{ request.path }}?newer_than={{newer_than}}{% if request.args.get('limit') %}&limit={{request.args.get('limit')}}{% endif %}{% if request.args.get('actor_id') %}&actor_id={{request.args.get('actor_id')}}{% endif %}" rel="prev" class="newer-link lcolor">Newer <span class="pcolor">🡪</span></a>
|
2018-07-06 21:53:33 +00:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% endmacro -%}
|
|
|
|
|
|
|
|
{% macro display_pagination_links(older_than, newer_than) -%}
|
|
|
|
{% if older_than %}<link rel="next" href="{{ config.BASE_URL }}{{ request.path }}?older_than={{older_than}}">{% endif %}
|
|
|
|
{% if newer_than %}<link rel="prev" href="{{ config.BASE_URL }}{{ request.path }}?newer_than={{newer_than}}">{% endif %}
|
|
|
|
{% endmacro -%}
|