More poll/question tweaks

This commit is contained in:
Thomas Sileo 2019-07-05 00:29:51 +02:00
parent 2a0b348796
commit 1dd7c516ed
3 changed files with 8 additions and 4 deletions

5
app.py
View file

@ -929,8 +929,11 @@ def _build_thread(data, include_children=True): # noqa: C901
} }
replies = [data] replies = [data]
for dat in DB.activities.find(query): for dat in DB.activities.find(query):
print(dat["type"])
if dat["type"][0] == ActivityType.CREATE.value: if dat["type"][0] == ActivityType.CREATE.value:
replies.append(dat) replies.append(dat)
if dat["type"][0] == ActivityType.UPDATE.value:
continue
else: else:
# Make a Note/Question/... looks like a Create # Make a Note/Question/... looks like a Create
dat = { dat = {
@ -958,7 +961,7 @@ def _build_thread(data, include_children=True): # noqa: C901
rep_id = rep["activity"]["object"]["id"] rep_id = rep["activity"]["object"]["id"]
if rep_id == root_id: if rep_id == root_id:
continue continue
reply_of = ap._get_id(rep["activity"]["object"]["inReplyTo"]) reply_of = ap._get_id(rep["activity"]["object"].get("inReplyTo"))
try: try:
idx[reply_of]["_nodes"].append(rep) idx[reply_of]["_nodes"].append(rep)
except KeyError: except KeyError:

View file

@ -214,7 +214,7 @@ a:hover {
overflow: hidden; overflow: hidden;
} }
.bottom-bar { margin-top:10px; } .bottom-bar { margin-top:10px;display:inline-block; }
.img-attachment { .img-attachment {
max-width:100%; max-width:100%;

View file

@ -86,7 +86,7 @@
{% set pct = cnt * 100.0 / total_votes %} {% set pct = cnt * 100.0 / total_votes %}
{% endif %} {% endif %}
<li class="answer"> <li class="answer">
{% if not meta.voted_for and not (real_end_time | gtnow) and not (obj.id | is_from_outbox) %} {% if session.logged_in and not meta.voted_for and not (real_end_time | gtnow) and not (obj.id | is_from_outbox) %}
<span><form action="/api/vote" class="action-form" method="POST"> <span><form action="/api/vote" class="action-form" method="POST">
<input type="hidden" name="redirect" value="{{ redir }}"> <input type="hidden" name="redirect" value="{{ redir }}">
<input type="hidden" name="id" value="{{ obj.id }}"> <input type="hidden" name="id" value="{{ obj.id }}">
@ -161,7 +161,8 @@
<div class="bottom-bar"> <div class="bottom-bar">
{% if perma %}<span class="perma-item">{{ obj.published | format_time }}</span> {% if perma %}
<span class="perma-item" style="float:left;padding:5px;">{{ obj.published | format_time }}</span>
{% if not (obj.id | is_from_outbox) %} {% if not (obj.id | is_from_outbox) %}
<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 %}