forked from forks/microblog.pub
Fix templates issues
This commit is contained in:
parent
b3c3ab0b03
commit
395fec012b
2 changed files with 38 additions and 36 deletions
3
app.py
3
app.py
|
@ -812,6 +812,7 @@ def index():
|
||||||
"meta.undo": False,
|
"meta.undo": False,
|
||||||
"$or": [{"meta.pinned": False}, {"meta.pinned": {"$exists": False}}],
|
"$or": [{"meta.pinned": False}, {"meta.pinned": {"$exists": False}}],
|
||||||
}
|
}
|
||||||
|
print(list(DB.activities.find(q)))
|
||||||
|
|
||||||
pinned = []
|
pinned = []
|
||||||
# Only fetch the pinned notes if we're on the first page
|
# Only fetch the pinned notes if we're on the first page
|
||||||
|
@ -2966,7 +2967,7 @@ def task_cleanup_part_1():
|
||||||
DB.activities.update_many(
|
DB.activities.update_many(
|
||||||
{
|
{
|
||||||
"box": Box.OUTBOX.value,
|
"box": Box.OUTBOX.value,
|
||||||
"type": ActivityType.CREATE.value,
|
"type": {"$in": [ActivityType.CREATE.value, ActivityType.ANNOUNCE.value]},
|
||||||
"meta.public": {"$exists": False},
|
"meta.public": {"$exists": False},
|
||||||
},
|
},
|
||||||
{"$set": {"meta.public": True}},
|
{"$set": {"meta.public": True}},
|
||||||
|
|
|
@ -16,26 +16,29 @@
|
||||||
{%- endmacro %}
|
{%- 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.actor %}
|
{% if meta.actor %}
|
||||||
{% set actor = meta.actor %}
|
{% set actor = meta.actor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set actor = obj.attributedTo | get_actor %}
|
{% set actor = obj.attributedTo | get_actor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
{% if session.logged_in %}
|
{% if session.logged_in %}
|
||||||
{% set perma_id = obj.id | permalink_id %}
|
{% set perma_id = obj.id | permalink_id %}
|
||||||
|
|
||||||
{% if request.args.get('older_than') %}
|
{% if request.args.get('older_than') %}
|
||||||
{% set redir = request.path + "?older_than=" + request.args.get('older_than') + "#activity-" + perma_id %}
|
{% set redir = request.path + "?older_than=" + request.args.get('older_than') + "#activity-" + perma_id %}
|
||||||
{% elif request.args.get('newer_than') %}
|
{% elif request.args.get('newer_than') %}
|
||||||
{% set redir = request.path + "?newer_than=" + request.args.get('newer_than') + "#activity-" + perma_id %}
|
{% set redir = request.path + "?newer_than=" + request.args.get('newer_than') + "#activity-" + perma_id %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set redir = request.path + "#activity-" + perma_id %}
|
{% set redir = request.path + "#activity-" + perma_id %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% set aid = obj.id | quote_plus %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="note-box">
|
<div class="note-box">
|
||||||
<div class="note h-entry" id="activity-{{ obj.id | permalink_id }}">
|
<div class="note h-entry" id="activity-{{ obj.id | permalink_id }}">
|
||||||
|
|
||||||
|
@ -57,6 +60,7 @@
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if obj.summary %}<p class="p-summary">{{ obj.summary | clean }}</p>{% endif %}
|
{% if obj.summary %}<p class="p-summary">{{ obj.summary | clean }}</p>{% endif %}
|
||||||
{% if obj | has_type('Video') %}
|
{% if obj | has_type('Video') %}
|
||||||
<div class="note-video">
|
<div class="note-video">
|
||||||
|
@ -64,37 +68,37 @@
|
||||||
</video>
|
</video>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="note-container{% if perma %} perma{%endif%} p-name e-content">
|
|
||||||
|
|
||||||
|
<div class="note-container{% if perma %} perma{%endif%} p-name e-content">
|
||||||
{% if obj | has_type('Article') %}
|
{% if obj | has_type('Article') %}
|
||||||
{{ obj.name }} <a href="{{ obj | url_or_id | get_url }}">{{ obj | url_or_id | get_url }}</a>
|
{{ obj.name }} <a href="{{ obj | url_or_id | get_url }}">{{ obj | url_or_id | get_url }}</a>
|
||||||
{% elif obj | has_type('Question') %}
|
{% elif obj | has_type('Question') %}
|
||||||
{{ obj.content | clean | safe }}
|
{{ obj.content | clean | safe }}
|
||||||
|
|
||||||
{% if obj.id | is_from_outbox or (meta.question_replies and (obj.closed or meta.voted_for)) %}
|
{% if obj.id | is_from_outbox or (meta.question_replies and (obj.closed or meta.voted_for)) %}
|
||||||
<ul style="list-style:none;padding:0;">
|
<ul style="list-style:none;padding:0;">
|
||||||
{% set total_votes = meta.question_replies %}
|
{% set total_votes = meta.question_replies %}
|
||||||
|
|
||||||
{% for oneOf in obj.oneOf %}
|
{% for oneOf in obj.oneOf %}
|
||||||
{% set pct = 0 %}
|
{% set pct = 0 %}
|
||||||
{% if total_votes > 0 %}
|
{% if total_votes > 0 %}
|
||||||
{% set cnt = oneOf.name | get_answer_count(meta) %}
|
{% set cnt = oneOf.name | get_answer_count(meta) %}
|
||||||
{% set pct = cnt * 100.0 / total_votes %}
|
{% set pct = cnt * 100.0 / total_votes %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li class="answer">
|
<li class="answer">
|
||||||
<span class="answer-bar color-menu-background" style="width:{{pct}}%;"></span>
|
<span class="answer-bar color-menu-background" style="width:{{pct}}%;"></span>
|
||||||
<span class="answer-text">
|
<span class="answer-text">
|
||||||
<span>{{ '%0.0f'| format(pct) }}%</span>
|
<span>{{ '%0.0f'| format(pct) }}%</span>
|
||||||
{{ oneOf.name }}
|
{{ oneOf.name }}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
<p><small>
|
<p><small>
|
||||||
{% if obj.closed or obj.endTime | gtnow %}
|
{% if obj.closed or obj.endTime | gtnow %}
|
||||||
Ended {{ obj.endTime | format_timeago }} with <strong>{{ total_votes }}</strong> vote{% if total_votes | gtone %}s{% endif %}.
|
Ended {{ obj.endTime | format_timeago }} with <strong>{{ total_votes }}</strong> vote{% if total_votes | gtone %}s{% endif %}.
|
||||||
{% else %}
|
{% else %}
|
||||||
Ends {{ obj.endTime | format_timeago }} (<strong>{{ total_votes }}</strong> vote{% if total_votes | gtone %}s{% endif %} as of now).
|
Ends {{ obj.endTime | format_timeago }} (<strong>{{ total_votes }}</strong> vote{% if total_votes | gtone %}s{% endif %} as of now).
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</small></p>
|
</small></p>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -184,9 +188,6 @@
|
||||||
<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>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% set aid = obj.id | quote_plus %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if meta.count_reply and obj.id | is_from_outbox %}<a class ="bar-item" href="{{ obj.url | get_url }}"><strong>{{ meta.count_reply }}</strong> replies</a>
|
{% if meta.count_reply and obj.id | is_from_outbox %}<a class ="bar-item" href="{{ obj.url | get_url }}"><strong>{{ meta.count_reply }}</strong> replies</a>
|
||||||
{% elif meta.count_reply and session.logged_in %}
|
{% elif meta.count_reply and session.logged_in %}
|
||||||
<a class ="bar-item" href="/admin/thread?oid={{aid}}"><strong>{{ meta.count_reply }}</strong> replies</a>{% endif %}
|
<a class ="bar-item" href="/admin/thread?oid={{aid}}"><strong>{{ meta.count_reply }}</strong> replies</a>{% endif %}
|
||||||
|
|
Loading…
Reference in a new issue