2018-06-23 10:01:31 +00:00
|
|
|
{% macro display_actor_inline(follower, size=50) -%}
|
2018-06-03 21:11:43 +00:00
|
|
|
<a class="actor-box" href="{{follower.url}}" style="clear:both;">
|
|
|
|
<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-06-23 10:01:31 +00:00
|
|
|
<img class="actor-icon" src="{{ follower.icon.url }}" 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">
|
2018-06-03 21:11:43 +00:00
|
|
|
<div style="font-weight:bold">{{ follower.name or follower.preferredUsername }}</div>
|
|
|
|
<small>@{{ follower.preferredUsername }}@{{ follower.url | domain }}</small>
|
|
|
|
</div>
|
|
|
|
</a>
|
|
|
|
{%- endmacro %}
|
|
|
|
|
|
|
|
|
2018-05-18 18:41:41 +00:00
|
|
|
{% macro display_actor(follower) -%}
|
2018-06-22 08:01:05 +00:00
|
|
|
<a class="actor-box-big" href="{{follower.url}}">
|
|
|
|
<div class="pure-g actor-box-wrapper">
|
2018-05-18 18:41:41 +00:00
|
|
|
<div class="pure-u-1-5">
|
|
|
|
{% if not follower.icon %}
|
|
|
|
<img class="actor-icon" src="/static/nopic.png">
|
|
|
|
{% else %}
|
|
|
|
<img class="actor-icon" src="{{ follower.icon.url }}">{% endif %}
|
|
|
|
</div>
|
|
|
|
<div class="pure-u-4-5">
|
|
|
|
<h3>{{ follower.name or follower.preferredUsername }}</h3>
|
|
|
|
<small>@{{ follower.preferredUsername }}@{{ follower.url | domain }}</small>
|
|
|
|
<div>{{ follower.summary | safe }}</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</a>
|
|
|
|
{%- endmacro %}
|
|
|
|
|
2018-06-03 21:36:16 +00:00
|
|
|
{% macro display_note(item, perma=False, ui=False, likes=[], shares=[]) -%}
|
2018-05-18 18:41:41 +00:00
|
|
|
{% set actor = item.activity.object.attributedTo | get_actor %}
|
|
|
|
<div class="note h-entry" id="activity-{{ item['_id'].__str__() }}">
|
|
|
|
|
|
|
|
<div class="h-card p-author">
|
|
|
|
<a class="u-url u-uid no-hover" href="{{ actor.url }}"><img class="u-photo" src="{% if not actor.icon %}/static/nopic.png{% else %}{{ actor.icon.url }}{% endif %}">
|
|
|
|
</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">
|
|
|
|
<a href="{{ actor.url }}" style="margin:0;text-decoration:none;" class="no-hover"><strong>{{ actor.name or actor.preferredUsername }}</strong> <span class="l">@{{ actor.preferredUsername }}@{{ actor.url | domain }}</span></a>
|
|
|
|
|
|
|
|
{% if not perma %}
|
|
|
|
<span style="float:right">
|
|
|
|
<a rel="noopener" class="u-url u-uid note-permalink l" href="{{ item.activity.object.url }}">
|
|
|
|
<time class="dt-published" title="{{ item.activity.object.published }}" datetime="{{ item.activity.object.published }}">{{ item.activity.object.published | format_timeago }}</time></a>
|
|
|
|
</span>
|
|
|
|
{% endif %}
|
|
|
|
{% if item.activity.object.summary %}<p class="p-summary">{{ item.activity.object.summary }}</p>{% endif %}
|
|
|
|
<div class="note-container{% if perma %} perma{%endif%} p-name e-content">
|
|
|
|
{{ item.activity.object.content | safe }}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{% if item.activity.object.attachment %}
|
|
|
|
<div style="padding:20px 0;">
|
|
|
|
{% if item.activity.object.attachment | not_only_imgs %}
|
|
|
|
<h3 class="l">Attachment</h3>
|
|
|
|
<ul>
|
|
|
|
{% endif %}
|
|
|
|
{% for a in item.activity.object.attachment %}
|
|
|
|
{% if a.url | is_img %}
|
|
|
|
<img src="{{a.url}}" class="img-attachment">
|
|
|
|
{% else %}
|
|
|
|
<li><a href="{{a.url}}" class="l">{% if a.filename %}{{ a.filename }}{% else %}{{ a.url }}{% endif %}</a></li>
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
{% if item.activity.object.attachment | not_only_imgs %}
|
|
|
|
</ul>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<div class="bottom-bar">
|
2018-06-03 21:36:16 +00:00
|
|
|
{% if perma %}<span class="perma-item">{{ item.activity.object.published | format_time }}</span>
|
|
|
|
{% else %}
|
2018-05-18 18:41:41 +00:00
|
|
|
<a class ="bar-item" href="{{ item.activity.object.url }}">permalink</a>
|
2018-06-03 10:15:30 +00:00
|
|
|
|
2018-06-23 10:01:31 +00:00
|
|
|
{% if item.meta.count_reply %}<a class ="bar-item" href="{{ item.activity.object.url }}"><strong>{{ item.meta.count_reply }}</strong> replies</a>{% endif %}
|
|
|
|
{% if item.meta.count_boost %}<a class ="bar-item" href="{{ item.activity.object.url }}"><strong>{{ item.meta.count_boost }}</strong> boosts</a>{% endif %}
|
|
|
|
{% if item.meta.count_like %}<a class ="bar-item" href="{{ item.activity.object.url }}"><strong>{{ item.meta.count_like }}</strong> likes</a>{% endif %}
|
2018-06-03 21:36:16 +00:00
|
|
|
{% endif %}
|
2018-06-03 10:15:30 +00:00
|
|
|
|
2018-06-03 19:28:06 +00:00
|
|
|
{% if ui and session.logged_in %}
|
2018-06-03 10:15:30 +00:00
|
|
|
|
2018-05-18 18:41:41 +00:00
|
|
|
{% set aid = item.activity.object.id | quote_plus %}
|
|
|
|
<a class="bar-item" href="/new?reply={{ aid }}">reply</a>
|
|
|
|
|
|
|
|
{% set redir = request.path + "#activity-" + item['_id'].__str__() %}
|
|
|
|
|
|
|
|
{% if item.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 }}">
|
|
|
|
<input type="hidden" name="id" value="{{ item.meta.boosted }}">
|
|
|
|
<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 }}">
|
|
|
|
<input type="hidden" name="id" value="{{ item.activity.object.id }}">
|
|
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
|
|
<button type="submit" class="bar-item">boost</button>
|
|
|
|
</form>
|
2018-05-18 18:41:41 +00:00
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if item.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 }}">
|
|
|
|
<input type="hidden" name="id" value="{{ item.meta.liked }}">
|
|
|
|
<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 }}">
|
|
|
|
<input type="hidden" name="id" value="{{ item.activity.object.id }}">
|
|
|
|
<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 %}
|
|
|
|
|
|
|
|
{% endif %}
|
2018-06-04 16:53:44 +00:00
|
|
|
|
|
|
|
{% if session.logged_in %}
|
|
|
|
{% if item.activity.id | is_from_outbox %}
|
|
|
|
<form action="/api/note/delete" class="action-form" method="POST">
|
|
|
|
<input type="hidden" name="redirect" value="{{ redir }}">
|
|
|
|
<input type="hidden" name="id" value="{{ item.activity.object.id }}">
|
|
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
|
|
<button type="submit" class="bar-item">delete</button>
|
|
|
|
</form>
|
|
|
|
{% else %}
|
|
|
|
<form action="/api/block" class="action-form" method="POST">
|
|
|
|
<input type="hidden" name="redirect" value="{{ redir }}">
|
|
|
|
<input type="hidden" name="actor" value="{{ item.activity.actor }}">
|
|
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
|
|
<button type="submit" class="bar-item">block</button>
|
|
|
|
</form>
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
|
2018-05-18 18:41:41 +00:00
|
|
|
</div>
|
|
|
|
|
2018-06-03 21:36:16 +00:00
|
|
|
{% if likes or shares %}
|
|
|
|
<div style="padding-top:20px;" class="pure-g">
|
2018-06-03 21:11:43 +00:00
|
|
|
{% if likes %}
|
2018-06-03 21:36:16 +00:00
|
|
|
<div class="pure-u-1-2">
|
|
|
|
<h4 style="font-weight:normal"><strong>{{ item.meta.count_like }}</strong> likes</h4>{% for like in likes %}
|
2018-06-03 21:11:43 +00:00
|
|
|
{{ display_actor_inline(like) }}
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2018-06-03 21:36:16 +00:00
|
|
|
{% 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>
|
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 %}
|
2018-06-03 21:36:16 +00:00
|
|
|
{{ display_note(reply, perma=True, ui=False, likes=likes, shares=shares) }}
|
2018-06-03 19:28:06 +00:00
|
|
|
{% else %}
|
|
|
|
{{ display_note(reply, perma=False, ui=True) }}
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
{% endmacro -%}
|