diff --git a/app.py b/app.py index 2854bc3..b5c913d 100644 --- a/app.py +++ b/app.py @@ -812,6 +812,7 @@ def index(): "meta.undo": False, "$or": [{"meta.pinned": False}, {"meta.pinned": {"$exists": False}}], } + print(list(DB.activities.find(q))) pinned = [] # 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( { "box": Box.OUTBOX.value, - "type": ActivityType.CREATE.value, + "type": {"$in": [ActivityType.CREATE.value, ActivityType.ANNOUNCE.value]}, "meta.public": {"$exists": False}, }, {"$set": {"meta.public": True}}, diff --git a/templates/utils.html b/templates/utils.html index bed5613..702018c 100644 --- a/templates/utils.html +++ b/templates/utils.html @@ -16,26 +16,29 @@ {%- endmacro %} {% macro display_note(obj, perma=False, ui=False, likes=[], shares=[], meta={}, no_color=False) -%} + {% if meta.actor %} -{% set actor = meta.actor %} + {% set actor = meta.actor %} {% else %} -{% set actor = obj.attributedTo | get_actor %} + {% set actor = obj.attributedTo | get_actor %} {% endif %} {% if session.logged_in %} -{% set perma_id = obj.id | permalink_id %} + {% set perma_id = obj.id | permalink_id %} -{% 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 %} + {% 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 %} + + {% set aid = obj.id | quote_plus %} {% endif %} -
@@ -57,6 +60,7 @@ {% endif %}
+ {% if obj.summary %}

{{ obj.summary | clean }}

{% endif %} {% if obj | has_type('Video') %}
@@ -64,37 +68,37 @@
{% endif %} -
+
{% if obj | has_type('Article') %} - {{ obj.name }} {{ obj | url_or_id | get_url }} + {{ obj.name }} {{ obj | url_or_id | get_url }} {% 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)) %} -
    - {% set total_votes = meta.question_replies %} + {% if obj.id | is_from_outbox or (meta.question_replies and (obj.closed or meta.voted_for)) %} +
      + {% set total_votes = meta.question_replies %} - {% for oneOf in obj.oneOf %} - {% set pct = 0 %} - {% if total_votes > 0 %} - {% set cnt = oneOf.name | get_answer_count(meta) %} - {% set pct = cnt * 100.0 / total_votes %} - {% endif %} -
    • - - - {{ '%0.0f'| format(pct) }}% - {{ oneOf.name }} - -
    • - {% endfor %} + {% for oneOf in obj.oneOf %} + {% set pct = 0 %} + {% if total_votes > 0 %} + {% set cnt = oneOf.name | get_answer_count(meta) %} + {% set pct = cnt * 100.0 / total_votes %} + {% endif %} +
    • + + + {{ '%0.0f'| format(pct) }}% + {{ oneOf.name }} + +
    • + {% endfor %}

    {% if obj.closed or obj.endTime | gtnow %} - Ended {{ obj.endTime | format_timeago }} with {{ total_votes }} vote{% if total_votes | gtone %}s{% endif %}. + Ended {{ obj.endTime | format_timeago }} with {{ total_votes }} vote{% if total_votes | gtone %}s{% endif %}. {% else %} - Ends {{ obj.endTime | format_timeago }} ({{ total_votes }} vote{% if total_votes | gtone %}s{% endif %} as of now). + Ends {{ obj.endTime | format_timeago }} ({{ total_votes }} vote{% if total_votes | gtone %}s{% endif %} as of now). {% endif %}

    {% else %} @@ -184,9 +188,6 @@ permalink {% endif %} -{% set aid = obj.id | quote_plus %} -{% endif %} - {% if meta.count_reply and obj.id | is_from_outbox %}{{ meta.count_reply }} replies {% elif meta.count_reply and session.logged_in %} {{ meta.count_reply }} replies{% endif %}