forked from forks/microblog.pub
Fix note creation
This commit is contained in:
parent
fb0081a554
commit
55cbd8b617
1 changed files with 5 additions and 4 deletions
|
@ -675,14 +675,15 @@ async def admin_actions_new(
|
|||
ap_type = "Note"
|
||||
|
||||
poll_duration_in_minutes = None
|
||||
poll_answers = None
|
||||
if poll_type:
|
||||
ap_type = "Question"
|
||||
answers = []
|
||||
poll_answers = []
|
||||
for i in ["1", "2", "3", "4"]:
|
||||
if answer := raw_form_data.get(f"poll_answer_{i}"):
|
||||
answers.append(answer)
|
||||
poll_answers.append(answer)
|
||||
|
||||
if not answers or len(answers) < 2:
|
||||
if not poll_answers or len(poll_answers) < 2:
|
||||
raise ValueError("Question must have at least 2 answers")
|
||||
|
||||
poll_duration_in_minutes = int(raw_form_data["poll_duration"])
|
||||
|
@ -697,7 +698,7 @@ async def admin_actions_new(
|
|||
content_warning=content_warning or None,
|
||||
is_sensitive=True if content_warning else is_sensitive,
|
||||
poll_type=poll_type,
|
||||
poll_answers=answers,
|
||||
poll_answers=poll_answers,
|
||||
poll_duration_in_minutes=poll_duration_in_minutes,
|
||||
)
|
||||
return RedirectResponse(
|
||||
|
|
Loading…
Reference in a new issue