Fix for local poll answers
This commit is contained in:
parent
4216b0b857
commit
bb43aec474
2 changed files with 8 additions and 1 deletions
|
@ -31,6 +31,7 @@ from config import ME
|
||||||
from config import USER_AGENT
|
from config import USER_AGENT
|
||||||
from core.db import find_one_activity
|
from core.db import find_one_activity
|
||||||
from core.db import update_many_activities
|
from core.db import update_many_activities
|
||||||
|
from core.db import update_one_activity
|
||||||
from core.meta import Box
|
from core.meta import Box
|
||||||
from core.meta import MetaKey
|
from core.meta import MetaKey
|
||||||
from core.meta import by_object_id
|
from core.meta import by_object_id
|
||||||
|
@ -682,7 +683,7 @@ def handle_question_reply(create: ap.Create, question: ap.Question) -> None:
|
||||||
by_remote_id(create.id),
|
by_remote_id(create.id),
|
||||||
{
|
{
|
||||||
"$set": {
|
"$set": {
|
||||||
"meta.answer_to": question.id,
|
"meta.poll_answer_to": question.id,
|
||||||
"meta.poll_answer_choice": choice,
|
"meta.poll_answer_choice": choice,
|
||||||
"meta.stream": False,
|
"meta.stream": False,
|
||||||
"meta.poll_answer": True,
|
"meta.poll_answer": True,
|
||||||
|
@ -727,6 +728,11 @@ def handle_replies(create: ap.Create) -> None:
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
# Mark our reply as a poll answers, to "hide" it from the UI
|
||||||
|
update_one_activity(
|
||||||
|
by_remote_id(create.id),
|
||||||
|
upsert({MetaKey.POLL_ANSWER: True, MetaKey.POLL_ANSWER_TO: reply.id}),
|
||||||
|
)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# It's a regular reply, try to increment the reply counter
|
# It's a regular reply, try to increment the reply counter
|
||||||
|
|
|
@ -24,6 +24,7 @@ class MetaKey(Enum):
|
||||||
NOTIFICATION_UNREAD = "notification_unread"
|
NOTIFICATION_UNREAD = "notification_unread"
|
||||||
NOTIFICATION_FOLLOWS_BACK = "notification_follows_back"
|
NOTIFICATION_FOLLOWS_BACK = "notification_follows_back"
|
||||||
POLL_ANSWER = "poll_answer"
|
POLL_ANSWER = "poll_answer"
|
||||||
|
POLL_ANSWER_TO = "poll_answer_to"
|
||||||
STREAM = "stream"
|
STREAM = "stream"
|
||||||
ACTOR_ID = "actor_id"
|
ACTOR_ID = "actor_id"
|
||||||
ACTOR = "actor"
|
ACTOR = "actor"
|
||||||
|
|
Loading…
Reference in a new issue