diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d4a008..64834ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,8 @@ Erste stabile Version. Fragengruppe), Bildauswahl, Bilder und Videos zu Fragen, Datei-Upload. - Bedingungen für Fragen, Abschnitte und Seiten; mehrseitige Formulare. - Abstimmungen über Texte oder Termine mit Vorschlägen, Bestätigung und - Kalender (Datei und Abo-Link). + Kalender (Datei und Abo-Link); bei einem neuen Vorschlag erfahren alle, die + schon teilgenommen haben, davon und können ihre Antwort ergänzen. - Teilnahme mit Plätzen, Warteliste und Nachrücken; Fragengruppen als kompakte Tabelle für Schichtpläne; eingetragene Namen anzeigen. - Zugang für alle Angemeldeten, nur Eingeladene (Benutzer, Gruppen, Gäste), diff --git a/docs/anwender.md b/docs/anwender.md index c423b32..c0bee3d 100644 --- a/docs/anwender.md +++ b/docs/anwender.md @@ -117,7 +117,9 @@ brauchen keine Antwort. Bei einer Abstimmung stimmen Sie für jede Option einzeln ab, etwa mit Ja, Vielleicht oder Nein. Ist es erlaubt, schlagen Sie unter *Weitere Option vorschlagen* bzw. *Weiteren Termin vorschlagen* etwas Eigenes vor. Ihr -Vorschlag erscheint danach für alle und zählt als Ihr „Ja“. +Vorschlag erscheint danach für alle und zählt als Ihr „Ja“. Wer schon +teilgenommen hat, bekommt eine Mail über den neuen Vorschlag und kann seine +Antwort ergänzen, sofern das Formular Änderungen erlaubt. Später bestätigen die Verantwortlichen eine oder mehrere Optionen. Sie erscheinen dann als *bestätigt*; mit Konto (und bei Gästen mit bestätigter @@ -237,6 +239,8 @@ Surveybox schickt Ihnen zum Beispiel: - eine Bestätigung Ihrer Teilnahme mit Link zum Formular, - eine Nachricht, wenn Sie von der Warteliste nachrücken oder ein Termin bestätigt oder gestrichen wurde, +- einen Hinweis, wenn in einer Abstimmung, an der Sie teilgenommen haben, + jemand eine weitere Option vorschlägt, - Einladungen und Erinnerungen zu Formularen, - Folge-Mails mit Unterlagen (als Download-Links, die nach einer Weile ablaufen), diff --git a/docs/ersteller.md b/docs/ersteller.md index c81e64e..4bd95c0 100644 --- a/docs/ersteller.md +++ b/docs/ersteller.md @@ -110,7 +110,11 @@ geben ihr die Bedingung *Nur anzeigen, wenn „Kommen Sie?“ ist „Ja“*. Optionen sind Texte oder Termine (Datum, optional Uhrzeit und Dauer; ohne Uhrzeit gilt der ganze Tag). Je Option stimmen Teilnehmende mit Ja/Nein oder Ja/Vielleicht/Nein ab. Mit *Teilnehmende dürfen weitere Optionen vorschlagen* -kommen eigene Vorschläge dazu; ein Vorschlag zählt als Ja der Person. +kommen eigene Vorschläge dazu; ein Vorschlag zählt als Ja der Person. Alle, +die schon teilgenommen haben, bekommen dazu eine Mail und können ihre Antwort +um den neuen Vorschlag ergänzen. Das setzt voraus, dass Teilnehmende ihre +Antwort ändern dürfen; sonst geht keine Mail hinaus. Bei anonymen Formularen +gibt es diese Mail nicht. Unter *Antworten* steht eine Ergebnistabelle, die Option mit den meisten „Ja“ ist mit ★ markiert. Dort **bestätigen** Sie eine oder mehrere Optionen, diff --git a/surveybox/forms/service.py b/surveybox/forms/service.py index 992f8fa..7f3e4e8 100644 --- a/surveybox/forms/service.py +++ b/surveybox/forms/service.py @@ -689,6 +689,8 @@ class Validation: errors: dict[int, str] = field(default_factory=dict) consent_error: bool = False hidden: set[int] = field(default_factory=set) # durch Bedingungen ausgeblendet + # Neue Vorschläge dieser Teilnahme: (Frage-ID, Options-ID), siehe apply_proposals + proposed: list[tuple[int, str]] = field(default_factory=list) @property def ok(self) -> bool: @@ -788,6 +790,7 @@ def apply_proposals( votes = dict((stored.get("value_json") or {}).get("votes") or {}) votes[option["id"]] = "yes" stored["value_json"] = {"votes": votes} + validation.proposed.append((question.id, option["id"])) return errors diff --git a/surveybox/locale/de/LC_MESSAGES/messages.po b/surveybox/locale/de/LC_MESSAGES/messages.po index 7d1bf94..06c3a59 100644 --- a/surveybox/locale/de/LC_MESSAGES/messages.po +++ b/surveybox/locale/de/LC_MESSAGES/messages.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Surveybox VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2026-11-26 14:08+0100\n" +"POT-Creation-Date: 2026-11-26 14:18+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: de\n" @@ -586,6 +586,10 @@ msgstr "Von der Warteliste nachgerückt" msgid "Date confirmed in a poll" msgstr "Termin in einer Abstimmung bestätigt" +#: surveybox/mail/custom.py +msgid "New option proposed in a poll" +msgstr "Neue Option in einer Abstimmung vorgeschlagen" + #: surveybox/mail/custom.py msgid "Chosen entry or date removed" msgstr "Gewählter Eintrag oder Termin entfernt" @@ -710,9 +714,10 @@ msgstr "Der Text muss {details} oder diese Platzhalter enthalten: %(names)s" #: surveybox/web/templates/mail/digest.txt surveybox/web/templates/mail/invitation.txt #: surveybox/web/templates/mail/invite.txt surveybox/web/templates/mail/participation.txt #: surveybox/web/templates/mail/password_reset.txt surveybox/web/templates/mail/promoted.txt -#: surveybox/web/templates/mail/register.txt surveybox/web/templates/mail/register_exists.txt -#: surveybox/web/templates/mail/reminder.txt surveybox/web/templates/mail/retention_notice.txt -#: surveybox/web/templates/mail/slot_full.txt surveybox/web/templates/mail/test.txt +#: surveybox/web/templates/mail/proposed.txt surveybox/web/templates/mail/register.txt +#: surveybox/web/templates/mail/register_exists.txt surveybox/web/templates/mail/reminder.txt +#: surveybox/web/templates/mail/retention_notice.txt surveybox/web/templates/mail/slot_full.txt +#: surveybox/web/templates/mail/test.txt #, python-format msgid "Hello %(name)s," msgstr "Hallo %(name)s," @@ -725,9 +730,10 @@ msgstr "Hallo %(name)s," #: surveybox/web/templates/mail/guest_receipt.txt surveybox/web/templates/mail/invitation.txt #: surveybox/web/templates/mail/invite.txt surveybox/web/templates/mail/participation.txt #: surveybox/web/templates/mail/password_reset.txt surveybox/web/templates/mail/promoted.txt -#: surveybox/web/templates/mail/register.txt surveybox/web/templates/mail/register_exists.txt -#: surveybox/web/templates/mail/reminder.txt surveybox/web/templates/mail/retention_notice.txt -#: surveybox/web/templates/mail/slot_full.txt surveybox/web/templates/mail/test.txt +#: surveybox/web/templates/mail/proposed.txt surveybox/web/templates/mail/register.txt +#: surveybox/web/templates/mail/register_exists.txt surveybox/web/templates/mail/reminder.txt +#: surveybox/web/templates/mail/retention_notice.txt surveybox/web/templates/mail/slot_full.txt +#: surveybox/web/templates/mail/test.txt msgid "Hello," msgstr "Hallo," @@ -755,6 +761,10 @@ msgstr "Folge-Mails mit Dokumenten zu Formularen, an denen ich teilgenommen habe msgid "An entry or date I chose has been removed from a form" msgstr "Ein Eintrag oder Termin, den ich gewählt hatte, wurde gestrichen" +#: surveybox/mail/notify.py +msgid "Someone has proposed a new option in a poll I took part in" +msgstr "In einer Abstimmung, an der ich teilgenommen habe, wurde eine neue Option vorgeschlagen" + #: surveybox/mail/notify.py msgid "Reminder about a form I was invited to" msgstr "Erinnerung an ein Formular, zu dem ich eingeladen wurde" @@ -6188,6 +6198,16 @@ msgstr "Ja / Vielleicht / Nein" msgid "Participants may propose further options" msgstr "Teilnehmende dürfen weitere Optionen vorschlagen" +#: surveybox/web/templates/question_edit.html +msgid "" +"A proposal counts as a “yes” from the person who made it. Everyone who has already taken part " +"gets an email about it so they can add to their answer, provided participants may change their " +"answer." +msgstr "" +"Ein Vorschlag zählt als „Ja“ der vorschlagenden Person. Alle, die schon teilgenommen haben, " +"bekommen dazu eine Mail, um ihre Antwort zu ergänzen, sofern Teilnehmende ihre Antwort ändern " +"dürfen." + #: surveybox/web/templates/question_edit.html msgid "" "Only used when the options are dates. Time and duration are optional; without a time the date " @@ -6984,6 +7004,33 @@ msgstr "" "Wenn Sie nicht mehr kommen können, ändern Sie bitte Ihre Antwort, damit die nächste Person " "nachrücken kann:" +#: surveybox/web/templates/mail/proposed.txt +#, python-format +msgid "New proposal: %(title)s" +msgstr "Neuer Vorschlag: %(title)s" + +#: surveybox/web/templates/mail/proposed.txt +#, python-format +msgid "A participant has proposed a further option in “%(title)s”:" +msgid_plural "Participants have proposed further options in “%(title)s”:" +msgstr[0] "Eine teilnehmende Person hat in „%(title)s“ eine weitere Option vorgeschlagen:" +msgstr[1] "Teilnehmende haben in „%(title)s“ weitere Optionen vorgeschlagen:" + +#: surveybox/web/templates/mail/proposed.txt +msgid "" +"You have already taken part. If you like, add your vote for the new option to your answer: open " +"your personal link from your confirmation email. You can request it again here:" +msgstr "" +"Sie haben schon teilgenommen. Wenn Sie möchten, ergänzen Sie Ihre Antwort um Ihre Stimme zum " +"neuen Vorschlag: Öffnen Sie dazu Ihren persönlichen Link aus der Eingangsbestätigung. Sie können " +"ihn hier erneut anfordern:" + +#: surveybox/web/templates/mail/proposed.txt +msgid "You have already taken part. If you like, add your vote for the new option to your answer:" +msgstr "" +"Sie haben schon teilgenommen. Wenn Sie möchten, ergänzen Sie Ihre Antwort um Ihre Stimme zum " +"neuen Vorschlag:" + #: surveybox/web/templates/mail/register.txt #, python-format msgid "Create your account at %(app)s" diff --git a/surveybox/locale/en/LC_MESSAGES/messages.po b/surveybox/locale/en/LC_MESSAGES/messages.po index 3e62152..24e6655 100644 --- a/surveybox/locale/en/LC_MESSAGES/messages.po +++ b/surveybox/locale/en/LC_MESSAGES/messages.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Surveybox VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2026-11-26 14:08+0100\n" +"POT-Creation-Date: 2026-11-26 14:18+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: en\n" @@ -586,6 +586,10 @@ msgstr "Moved up from the waiting list" msgid "Date confirmed in a poll" msgstr "Date confirmed in a poll" +#: surveybox/mail/custom.py +msgid "New option proposed in a poll" +msgstr "New option proposed in a poll" + #: surveybox/mail/custom.py msgid "Chosen entry or date removed" msgstr "Chosen entry or date removed" @@ -710,9 +714,10 @@ msgstr "The text must contain {details} or these placeholders: %(names)s" #: surveybox/web/templates/mail/digest.txt surveybox/web/templates/mail/invitation.txt #: surveybox/web/templates/mail/invite.txt surveybox/web/templates/mail/participation.txt #: surveybox/web/templates/mail/password_reset.txt surveybox/web/templates/mail/promoted.txt -#: surveybox/web/templates/mail/register.txt surveybox/web/templates/mail/register_exists.txt -#: surveybox/web/templates/mail/reminder.txt surveybox/web/templates/mail/retention_notice.txt -#: surveybox/web/templates/mail/slot_full.txt surveybox/web/templates/mail/test.txt +#: surveybox/web/templates/mail/proposed.txt surveybox/web/templates/mail/register.txt +#: surveybox/web/templates/mail/register_exists.txt surveybox/web/templates/mail/reminder.txt +#: surveybox/web/templates/mail/retention_notice.txt surveybox/web/templates/mail/slot_full.txt +#: surveybox/web/templates/mail/test.txt #, python-format msgid "Hello %(name)s," msgstr "Hello %(name)s," @@ -725,9 +730,10 @@ msgstr "Hello %(name)s," #: surveybox/web/templates/mail/guest_receipt.txt surveybox/web/templates/mail/invitation.txt #: surveybox/web/templates/mail/invite.txt surveybox/web/templates/mail/participation.txt #: surveybox/web/templates/mail/password_reset.txt surveybox/web/templates/mail/promoted.txt -#: surveybox/web/templates/mail/register.txt surveybox/web/templates/mail/register_exists.txt -#: surveybox/web/templates/mail/reminder.txt surveybox/web/templates/mail/retention_notice.txt -#: surveybox/web/templates/mail/slot_full.txt surveybox/web/templates/mail/test.txt +#: surveybox/web/templates/mail/proposed.txt surveybox/web/templates/mail/register.txt +#: surveybox/web/templates/mail/register_exists.txt surveybox/web/templates/mail/reminder.txt +#: surveybox/web/templates/mail/retention_notice.txt surveybox/web/templates/mail/slot_full.txt +#: surveybox/web/templates/mail/test.txt msgid "Hello," msgstr "Hello," @@ -755,6 +761,10 @@ msgstr "Follow-up emails with documents from forms I took part in" msgid "An entry or date I chose has been removed from a form" msgstr "An entry or date I chose has been removed from a form" +#: surveybox/mail/notify.py +msgid "Someone has proposed a new option in a poll I took part in" +msgstr "Someone has proposed a new option in a poll I took part in" + #: surveybox/mail/notify.py msgid "Reminder about a form I was invited to" msgstr "Reminder about a form I was invited to" @@ -6122,6 +6132,16 @@ msgstr "Yes / Maybe / No" msgid "Participants may propose further options" msgstr "Participants may propose further options" +#: surveybox/web/templates/question_edit.html +msgid "" +"A proposal counts as a “yes” from the person who made it. Everyone who has already taken part " +"gets an email about it so they can add to their answer, provided participants may change their " +"answer." +msgstr "" +"A proposal counts as a “yes” from the person who made it. Everyone who has already taken part " +"gets an email about it so they can add to their answer, provided participants may change their " +"answer." + #: surveybox/web/templates/question_edit.html msgid "" "Only used when the options are dates. Time and duration are optional; without a time the date " @@ -6904,6 +6924,30 @@ msgstr "" msgid "If you can no longer come, please change your answer so that the next person can move up:" msgstr "If you can no longer come, please change your answer so that the next person can move up:" +#: surveybox/web/templates/mail/proposed.txt +#, python-format +msgid "New proposal: %(title)s" +msgstr "New proposal: %(title)s" + +#: surveybox/web/templates/mail/proposed.txt +#, python-format +msgid "A participant has proposed a further option in “%(title)s”:" +msgid_plural "Participants have proposed further options in “%(title)s”:" +msgstr[0] "A participant has proposed a further option in “%(title)s”:" +msgstr[1] "Participants have proposed further options in “%(title)s”:" + +#: surveybox/web/templates/mail/proposed.txt +msgid "" +"You have already taken part. If you like, add your vote for the new option to your answer: open " +"your personal link from your confirmation email. You can request it again here:" +msgstr "" +"You have already taken part. If you like, add your vote for the new option to your answer: open " +"your personal link from your confirmation email. You can request it again here:" + +#: surveybox/web/templates/mail/proposed.txt +msgid "You have already taken part. If you like, add your vote for the new option to your answer:" +msgstr "You have already taken part. If you like, add your vote for the new option to your answer:" + #: surveybox/web/templates/mail/register.txt #, python-format msgid "Create your account at %(app)s" diff --git a/surveybox/locale/fr/LC_MESSAGES/messages.po b/surveybox/locale/fr/LC_MESSAGES/messages.po index 9a6980f..1a56c84 100644 --- a/surveybox/locale/fr/LC_MESSAGES/messages.po +++ b/surveybox/locale/fr/LC_MESSAGES/messages.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Surveybox VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2026-11-26 14:08+0100\n" +"POT-Creation-Date: 2026-11-26 14:18+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: fr\n" @@ -586,6 +586,10 @@ msgstr "Passé de la liste d’attente" msgid "Date confirmed in a poll" msgstr "Date confirmée dans un sondage" +#: surveybox/mail/custom.py +msgid "New option proposed in a poll" +msgstr "Nouvelle option proposée dans un sondage" + #: surveybox/mail/custom.py msgid "Chosen entry or date removed" msgstr "Entrée ou date choisie supprimée" @@ -710,9 +714,10 @@ msgstr "Le texte doit contenir {details} ou ces espaces réservés : %(names)s" #: surveybox/web/templates/mail/digest.txt surveybox/web/templates/mail/invitation.txt #: surveybox/web/templates/mail/invite.txt surveybox/web/templates/mail/participation.txt #: surveybox/web/templates/mail/password_reset.txt surveybox/web/templates/mail/promoted.txt -#: surveybox/web/templates/mail/register.txt surveybox/web/templates/mail/register_exists.txt -#: surveybox/web/templates/mail/reminder.txt surveybox/web/templates/mail/retention_notice.txt -#: surveybox/web/templates/mail/slot_full.txt surveybox/web/templates/mail/test.txt +#: surveybox/web/templates/mail/proposed.txt surveybox/web/templates/mail/register.txt +#: surveybox/web/templates/mail/register_exists.txt surveybox/web/templates/mail/reminder.txt +#: surveybox/web/templates/mail/retention_notice.txt surveybox/web/templates/mail/slot_full.txt +#: surveybox/web/templates/mail/test.txt #, python-format msgid "Hello %(name)s," msgstr "Bonjour %(name)s," @@ -725,9 +730,10 @@ msgstr "Bonjour %(name)s," #: surveybox/web/templates/mail/guest_receipt.txt surveybox/web/templates/mail/invitation.txt #: surveybox/web/templates/mail/invite.txt surveybox/web/templates/mail/participation.txt #: surveybox/web/templates/mail/password_reset.txt surveybox/web/templates/mail/promoted.txt -#: surveybox/web/templates/mail/register.txt surveybox/web/templates/mail/register_exists.txt -#: surveybox/web/templates/mail/reminder.txt surveybox/web/templates/mail/retention_notice.txt -#: surveybox/web/templates/mail/slot_full.txt surveybox/web/templates/mail/test.txt +#: surveybox/web/templates/mail/proposed.txt surveybox/web/templates/mail/register.txt +#: surveybox/web/templates/mail/register_exists.txt surveybox/web/templates/mail/reminder.txt +#: surveybox/web/templates/mail/retention_notice.txt surveybox/web/templates/mail/slot_full.txt +#: surveybox/web/templates/mail/test.txt msgid "Hello," msgstr "Bonjour," @@ -755,6 +761,10 @@ msgstr "E-mails de suivi avec documents des formulaires auxquels j’ai particip msgid "An entry or date I chose has been removed from a form" msgstr "Une entrée ou une date que j’avais choisie a été supprimée" +#: surveybox/mail/notify.py +msgid "Someone has proposed a new option in a poll I took part in" +msgstr "Une nouvelle option a été proposée dans un sondage auquel j’ai participé" + #: surveybox/mail/notify.py msgid "Reminder about a form I was invited to" msgstr "Rappel concernant un formulaire auquel j’ai été invité" @@ -6210,6 +6220,16 @@ msgstr "Oui / Peut-être / Non" msgid "Participants may propose further options" msgstr "Les participants peuvent proposer d’autres options" +#: surveybox/web/templates/question_edit.html +msgid "" +"A proposal counts as a “yes” from the person who made it. Everyone who has already taken part " +"gets an email about it so they can add to their answer, provided participants may change their " +"answer." +msgstr "" +"Une proposition compte comme un « oui » de la personne qui l’a faite. Toutes les personnes ayant " +"déjà participé reçoivent un e-mail pour compléter leur réponse, à condition que les participants " +"puissent modifier leur réponse." + #: surveybox/web/templates/question_edit.html msgid "" "Only used when the options are dates. Time and duration are optional; without a time the date " @@ -7020,6 +7040,33 @@ msgstr "" "Si vous ne pouvez plus venir, modifiez votre réponse pour que la personne suivante puisse prendre" " la place :" +#: surveybox/web/templates/mail/proposed.txt +#, python-format +msgid "New proposal: %(title)s" +msgstr "Nouvelle proposition : %(title)s" + +#: surveybox/web/templates/mail/proposed.txt +#, python-format +msgid "A participant has proposed a further option in “%(title)s”:" +msgid_plural "Participants have proposed further options in “%(title)s”:" +msgstr[0] "Un participant a proposé une option supplémentaire dans « %(title)s » :" +msgstr[1] "Des participants ont proposé des options supplémentaires dans « %(title)s » :" + +#: surveybox/web/templates/mail/proposed.txt +msgid "" +"You have already taken part. If you like, add your vote for the new option to your answer: open " +"your personal link from your confirmation email. You can request it again here:" +msgstr "" +"Vous avez déjà participé. Si vous le souhaitez, complétez votre réponse en votant pour la " +"nouvelle option : ouvrez pour cela votre lien personnel figurant dans l’e-mail de confirmation. " +"Vous pouvez le demander à nouveau ici :" + +#: surveybox/web/templates/mail/proposed.txt +msgid "You have already taken part. If you like, add your vote for the new option to your answer:" +msgstr "" +"Vous avez déjà participé. Si vous le souhaitez, complétez votre réponse en votant pour la " +"nouvelle option :" + #: surveybox/web/templates/mail/register.txt #, python-format msgid "Create your account at %(app)s" diff --git a/surveybox/locale/messages.pot b/surveybox/locale/messages.pot index 8bea036..ab10ba2 100644 --- a/surveybox/locale/messages.pot +++ b/surveybox/locale/messages.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2026-11-26 14:08+0100\n" +"POT-Creation-Date: 2026-11-26 14:18+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -411,12 +411,12 @@ msgstr "" msgid "Number" msgstr "" -#: surveybox/forms/types.py:70 surveybox/web/templates/question_edit.html:141 +#: surveybox/forms/types.py:70 surveybox/web/templates/question_edit.html:142 msgid "Date" msgstr "" #: surveybox/forms/types.py:71 surveybox/web/templates/admin_audit.html:10 -#: surveybox/web/templates/question_edit.html:142 +#: surveybox/web/templates/question_edit.html:143 msgid "Time" msgstr "" @@ -642,124 +642,128 @@ msgid "Date confirmed in a poll" msgstr "" #: surveybox/mail/custom.py:49 +msgid "New option proposed in a poll" +msgstr "" + +#: surveybox/mail/custom.py:50 msgid "Chosen entry or date removed" msgstr "" -#: surveybox/mail/custom.py:50 surveybox/mail/notify.py:82 +#: surveybox/mail/custom.py:51 surveybox/mail/notify.py:84 msgid "Invitation to a form" msgstr "" -#: surveybox/mail/custom.py:51 +#: surveybox/mail/custom.py:52 msgid "Reminder to invited people" msgstr "" -#: surveybox/mail/custom.py:52 surveybox/web/routes/admin_mail.py:40 +#: surveybox/mail/custom.py:53 surveybox/web/routes/admin_mail.py:40 msgid "Comment published" msgstr "" -#: surveybox/mail/custom.py:53 +#: surveybox/mail/custom.py:54 msgid "New comment (managers)" msgstr "" -#: surveybox/mail/custom.py:54 +#: surveybox/mail/custom.py:55 msgid "Entry booked up (owner)" msgstr "" -#: surveybox/mail/custom.py:55 +#: surveybox/mail/custom.py:56 msgid "Form has reached its end date (owner)" msgstr "" -#: surveybox/mail/custom.py:56 +#: surveybox/mail/custom.py:57 msgid "Daily summary (managers)" msgstr "" -#: surveybox/mail/custom.py:57 +#: surveybox/mail/custom.py:58 msgid "Retention period ends soon (owner)" msgstr "" -#: surveybox/mail/custom.py:62 +#: surveybox/mail/custom.py:63 msgid "name of the recipient (may be empty)" msgstr "" -#: surveybox/mail/custom.py:63 +#: surveybox/mail/custom.py:64 msgid "the main link of this email" msgstr "" -#: surveybox/mail/custom.py:64 +#: surveybox/mail/custom.py:65 msgid "link to confirm the email address (only if one is needed)" msgstr "" -#: surveybox/mail/custom.py:65 +#: surveybox/mail/custom.py:66 msgid "the entry concerned" msgstr "" -#: surveybox/mail/custom.py:66 +#: surveybox/mail/custom.py:67 msgid "end date of the form" msgstr "" -#: surveybox/mail/custom.py:67 +#: surveybox/mail/custom.py:68 msgid "date of the deletion" msgstr "" -#: surveybox/mail/custom.py:68 +#: surveybox/mail/custom.py:69 msgid "number of answers" msgstr "" -#: surveybox/mail/custom.py:69 +#: surveybox/mail/custom.py:70 msgid "page to request personal links again" msgstr "" -#: surveybox/mail/custom.py:70 +#: surveybox/mail/custom.py:71 msgid "page “Forgot password”" msgstr "" -#: surveybox/mail/custom.py:71 +#: surveybox/mail/custom.py:72 msgid "sign-in page" msgstr "" -#: surveybox/mail/custom.py:72 +#: surveybox/mail/custom.py:73 msgid "settings of the form" msgstr "" -#: surveybox/mail/custom.py:73 +#: surveybox/mail/custom.py:74 msgid "link to stop emails about an invitation (guests only)" msgstr "" -#: surveybox/mail/custom.py:78 +#: surveybox/mail/custom.py:79 msgid "greeting, e.g. “Hello Erika,”" msgstr "" -#: surveybox/mail/custom.py:79 +#: surveybox/mail/custom.py:80 msgid "the standard text of this email without the greeting" msgstr "" -#: surveybox/mail/custom.py:80 +#: surveybox/mail/custom.py:81 msgid "name of the application" msgstr "" -#: surveybox/mail/custom.py:107 +#: surveybox/mail/custom.py:108 msgid "title of the form" msgstr "" -#: surveybox/mail/custom.py:172 +#: surveybox/mail/custom.py:173 msgid "Please enter a subject (one line, at most 200 characters)." msgstr "" -#: surveybox/mail/custom.py:173 +#: surveybox/mail/custom.py:174 msgid "Please enter a text (at most 10,000 characters)." msgstr "" -#: surveybox/mail/custom.py:174 +#: surveybox/mail/custom.py:175 #, python-format msgid "Unknown placeholders: %(names)s" msgstr "" -#: surveybox/mail/custom.py:175 +#: surveybox/mail/custom.py:176 #, python-brace-format, python-format msgid "The text must contain {details} or these placeholders: %(names)s" msgstr "" -#: surveybox/mail/custom.py:208 surveybox/web/templates/mail/changed.txt:2 +#: surveybox/mail/custom.py:209 surveybox/web/templates/mail/changed.txt:2 #: surveybox/web/templates/mail/comment_new.txt:2 #: surveybox/web/templates/mail/comment_published.txt:2 #: surveybox/web/templates/mail/confirmed.txt:2 @@ -770,6 +774,7 @@ msgstr "" #: surveybox/web/templates/mail/participation.txt:2 #: surveybox/web/templates/mail/password_reset.txt:2 #: surveybox/web/templates/mail/promoted.txt:2 +#: surveybox/web/templates/mail/proposed.txt:2 #: surveybox/web/templates/mail/register.txt:2 #: surveybox/web/templates/mail/register_exists.txt:2 #: surveybox/web/templates/mail/reminder.txt:2 @@ -780,7 +785,7 @@ msgstr "" msgid "Hello %(name)s," msgstr "" -#: surveybox/mail/custom.py:209 surveybox/web/templates/mail/changed.txt:2 +#: surveybox/mail/custom.py:210 surveybox/web/templates/mail/changed.txt:2 #: surveybox/web/templates/mail/comment_new.txt:2 #: surveybox/web/templates/mail/comment_published.txt:2 #: surveybox/web/templates/mail/confirmed.txt:2 @@ -795,6 +800,7 @@ msgstr "" #: surveybox/web/templates/mail/participation.txt:2 #: surveybox/web/templates/mail/password_reset.txt:2 #: surveybox/web/templates/mail/promoted.txt:2 +#: surveybox/web/templates/mail/proposed.txt:2 #: surveybox/web/templates/mail/register.txt:2 #: surveybox/web/templates/mail/register_exists.txt:2 #: surveybox/web/templates/mail/reminder.txt:2 @@ -828,23 +834,27 @@ msgstr "" msgid "An entry or date I chose has been removed from a form" msgstr "" -#: surveybox/mail/notify.py:83 -msgid "Reminder about a form I was invited to" -msgstr "" - -#: surveybox/mail/notify.py:84 -msgid "New comments on forms I manage" +#: surveybox/mail/notify.py:82 +msgid "Someone has proposed a new option in a poll I took part in" msgstr "" #: surveybox/mail/notify.py:85 -msgid "An entry in a form I own is booked up" +msgid "Reminder about a form I was invited to" msgstr "" #: surveybox/mail/notify.py:86 -msgid "A form I own has reached its end date" +msgid "New comments on forms I manage" msgstr "" #: surveybox/mail/notify.py:87 +msgid "An entry in a form I own is booked up" +msgstr "" + +#: surveybox/mail/notify.py:88 +msgid "A form I own has reached its end date" +msgstr "" + +#: surveybox/mail/notify.py:89 msgid "Daily summary of new and changed answers to forms I manage" msgstr "" @@ -2178,8 +2188,8 @@ msgstr "" #: surveybox/web/templates/form_access.html:26 #: surveybox/web/templates/form_designer.html:51 #: surveybox/web/templates/personal.html:59 -#: surveybox/web/templates/question_edit.html:276 -#: surveybox/web/templates/question_edit.html:298 +#: surveybox/web/templates/question_edit.html:277 +#: surveybox/web/templates/question_edit.html:299 msgid "Save" msgstr "" @@ -2351,7 +2361,7 @@ msgstr[1] "" #: surveybox/web/templates/_fill_fields.html:204 #: surveybox/web/templates/form_responses.html:86 -#: surveybox/web/templates/question_edit.html:190 +#: surveybox/web/templates/question_edit.html:191 msgid "proposed" msgstr "" @@ -2463,14 +2473,14 @@ msgstr[1] "" #: surveybox/web/templates/_fill_fields.html:366 #: surveybox/web/templates/question_edit.html:39 -#: surveybox/web/templates/question_edit.html:244 +#: surveybox/web/templates/question_edit.html:245 msgid "Question" msgstr "" #: surveybox/web/templates/_fill_fields.html:368 #: surveybox/web/templates/form_responses.html:102 -#: surveybox/web/templates/question_edit.html:189 -#: surveybox/web/templates/question_edit.html:205 +#: surveybox/web/templates/question_edit.html:190 +#: surveybox/web/templates/question_edit.html:206 msgid "Places" msgstr "" @@ -2584,7 +2594,7 @@ msgstr "" #: surveybox/web/templates/admin_group_edit.html:50 #: surveybox/web/templates/followup_edit.html:73 #: surveybox/web/templates/form_team.html:19 -#: surveybox/web/templates/question_edit.html:301 +#: surveybox/web/templates/question_edit.html:302 msgid "Remove" msgstr "" @@ -2896,8 +2906,8 @@ msgid "" msgstr "" #: surveybox/web/templates/admin_appearance.html:62 -#: surveybox/web/templates/question_edit.html:161 -#: surveybox/web/templates/question_edit.html:168 +#: surveybox/web/templates/question_edit.html:162 +#: surveybox/web/templates/question_edit.html:169 msgid "Display" msgstr "" @@ -3113,7 +3123,7 @@ msgstr "" #: surveybox/web/templates/admin_audit.html:10 #: surveybox/web/templates/followup_recipients.html:20 -#: surveybox/web/templates/question_edit.html:233 +#: surveybox/web/templates/question_edit.html:234 msgid "Action" msgstr "" @@ -4730,8 +4740,8 @@ msgid "Video" msgstr "" #: surveybox/web/templates/form_designer.html:106 -#: surveybox/web/templates/question_edit.html:165 -#: surveybox/web/templates/question_edit.html:171 +#: surveybox/web/templates/question_edit.html:166 +#: surveybox/web/templates/question_edit.html:172 msgid "Image tiles" msgstr "" @@ -4764,17 +4774,17 @@ msgid "No questions yet: add questions of this type directly below the group." msgstr "" #: surveybox/web/templates/form_designer.html:125 -#: surveybox/web/templates/question_edit.html:226 +#: surveybox/web/templates/question_edit.html:227 msgid "Applies to the whole page." msgstr "" #: surveybox/web/templates/form_designer.html:125 -#: surveybox/web/templates/question_edit.html:227 +#: surveybox/web/templates/question_edit.html:228 msgid "Applies to the whole section up to the next heading or page." msgstr "" #: surveybox/web/templates/form_designer.html:125 -#: surveybox/web/templates/question_edit.html:228 +#: surveybox/web/templates/question_edit.html:229 msgid "Applies to all questions of the group." msgstr "" @@ -4787,12 +4797,12 @@ msgid "Add question to group" msgstr "" #: surveybox/web/templates/form_designer.html:137 -#: surveybox/web/templates/question_edit.html:299 +#: surveybox/web/templates/question_edit.html:300 msgid "Move up" msgstr "" #: surveybox/web/templates/form_designer.html:143 -#: surveybox/web/templates/question_edit.html:300 +#: surveybox/web/templates/question_edit.html:301 msgid "Move down" msgstr "" @@ -5025,7 +5035,7 @@ msgstr "" #: surveybox/web/templates/form_invitations.html:11 #: surveybox/web/templates/question_edit.html:126 -#: surveybox/web/templates/question_edit.html:135 +#: surveybox/web/templates/question_edit.html:136 msgid "Dates" msgstr "" @@ -5292,7 +5302,7 @@ msgstr[0] "" msgstr[1] "" #: surveybox/web/templates/form_responses.html:82 -#: surveybox/web/templates/question_edit.html:259 +#: surveybox/web/templates/question_edit.html:260 #: surveybox/web/templates/results_public.html:21 msgid "Option" msgstr "" @@ -6368,253 +6378,260 @@ msgstr "" msgid "Participants may propose further options" msgstr "" -#: surveybox/web/templates/question_edit.html:136 +#: surveybox/web/templates/question_edit.html:134 +msgid "" +"A proposal counts as a “yes” from the person who made it. Everyone who " +"has already taken part gets an email about it so they can add to their " +"answer, provided participants may change their answer." +msgstr "" + +#: surveybox/web/templates/question_edit.html:137 msgid "" "Only used when the options are dates. Time and duration are optional; " "without a time the date counts as a whole day." msgstr "" -#: surveybox/web/templates/question_edit.html:143 +#: surveybox/web/templates/question_edit.html:144 msgid "Duration (min.)" msgstr "" -#: surveybox/web/templates/question_edit.html:144 +#: surveybox/web/templates/question_edit.html:145 msgid "Note" msgstr "" -#: surveybox/web/templates/question_edit.html:147 -#: surveybox/web/templates/question_edit.html:211 +#: surveybox/web/templates/question_edit.html:148 +#: surveybox/web/templates/question_edit.html:212 msgid "Add row" msgstr "" -#: surveybox/web/templates/question_edit.html:150 +#: surveybox/web/templates/question_edit.html:151 msgid "Scale from 1 to" msgstr "" -#: surveybox/web/templates/question_edit.html:154 +#: surveybox/web/templates/question_edit.html:155 msgid "Label for the lowest value (optional)" msgstr "" -#: surveybox/web/templates/question_edit.html:156 +#: surveybox/web/templates/question_edit.html:157 msgid "Label for the highest value (optional)" msgstr "" -#: surveybox/web/templates/question_edit.html:163 +#: surveybox/web/templates/question_edit.html:164 msgid "List with buttons" msgstr "" -#: surveybox/web/templates/question_edit.html:164 +#: surveybox/web/templates/question_edit.html:165 msgid "Drop-down list" msgstr "" -#: surveybox/web/templates/question_edit.html:170 +#: surveybox/web/templates/question_edit.html:171 msgid "List with checkboxes" msgstr "" -#: surveybox/web/templates/question_edit.html:173 +#: surveybox/web/templates/question_edit.html:174 msgid "Choose at least (0 = no minimum)" msgstr "" -#: surveybox/web/templates/question_edit.html:175 +#: surveybox/web/templates/question_edit.html:176 msgid "Choose at most (0 = no maximum)" msgstr "" -#: surveybox/web/templates/question_edit.html:181 +#: surveybox/web/templates/question_edit.html:182 msgid "Options" msgstr "" -#: surveybox/web/templates/question_edit.html:182 +#: surveybox/web/templates/question_edit.html:183 msgid "" "One option per line. Empty lines are ignored; to remove an option, delete" " its text. Renaming keeps existing answers." msgstr "" -#: surveybox/web/templates/question_edit.html:184 +#: surveybox/web/templates/question_edit.html:185 msgid "Images per option are shown with the display “Image tiles”." msgstr "" -#: surveybox/web/templates/question_edit.html:188 +#: surveybox/web/templates/question_edit.html:189 #, python-format msgid "Option %(n)s" msgstr "" -#: surveybox/web/templates/question_edit.html:194 +#: surveybox/web/templates/question_edit.html:195 msgid "Remove image" msgstr "" -#: surveybox/web/templates/question_edit.html:196 +#: surveybox/web/templates/question_edit.html:197 #, python-format msgid "Image for option %(n)s" msgstr "" -#: surveybox/web/templates/question_edit.html:204 +#: surveybox/web/templates/question_edit.html:205 msgid "New option" msgstr "" -#: surveybox/web/templates/question_edit.html:207 +#: surveybox/web/templates/question_edit.html:208 msgid "Image for the new option" msgstr "" -#: surveybox/web/templates/question_edit.html:214 +#: surveybox/web/templates/question_edit.html:215 msgid "Offer “Other” with a text field" msgstr "" -#: surveybox/web/templates/question_edit.html:221 +#: surveybox/web/templates/question_edit.html:222 msgid "Condition (optional)" msgstr "" -#: surveybox/web/templates/question_edit.html:223 +#: surveybox/web/templates/question_edit.html:224 msgid "" "A condition refers to earlier questions with an answer. There are none " "before this one yet." msgstr "" -#: surveybox/web/templates/question_edit.html:230 +#: surveybox/web/templates/question_edit.html:231 msgid "" "Hidden questions are not required; their answers are discarded when " "submitting." msgstr "" -#: surveybox/web/templates/question_edit.html:234 +#: surveybox/web/templates/question_edit.html:235 msgid "Show only if" msgstr "" -#: surveybox/web/templates/question_edit.html:235 +#: surveybox/web/templates/question_edit.html:236 msgid "Hide if" msgstr "" -#: surveybox/web/templates/question_edit.html:237 +#: surveybox/web/templates/question_edit.html:238 msgid "Combination" msgstr "" -#: surveybox/web/templates/question_edit.html:238 +#: surveybox/web/templates/question_edit.html:239 msgid "all rules apply (AND)" msgstr "" -#: surveybox/web/templates/question_edit.html:239 +#: surveybox/web/templates/question_edit.html:240 msgid "at least one rule applies (OR)" msgstr "" -#: surveybox/web/templates/question_edit.html:250 +#: surveybox/web/templates/question_edit.html:251 msgid "Comparison" msgstr "" -#: surveybox/web/templates/question_edit.html:256 +#: surveybox/web/templates/question_edit.html:257 msgid "Value" msgstr "" -#: surveybox/web/templates/question_edit.html:272 +#: surveybox/web/templates/question_edit.html:273 msgid "" "For choice and yes/no questions pick the option, otherwise enter the " "value. Dates as 2026-07-01, times as 18:30. Rows without a question are " "ignored." msgstr "" -#: surveybox/web/templates/question_edit.html:284 +#: surveybox/web/templates/question_edit.html:285 msgid "Images and video" msgstr "" -#: surveybox/web/templates/question_edit.html:285 +#: surveybox/web/templates/question_edit.html:286 msgid "" "Shown above the question: one or more images or one video. Adding a video" " replaces the images and vice versa." msgstr "" -#: surveybox/web/templates/question_edit.html:295 -#: surveybox/web/templates/question_edit.html:329 +#: surveybox/web/templates/question_edit.html:296 +#: surveybox/web/templates/question_edit.html:330 msgid "Description for screen readers" msgstr "" -#: surveybox/web/templates/question_edit.html:311 +#: surveybox/web/templates/question_edit.html:312 msgid "Remove preview image" msgstr "" -#: surveybox/web/templates/question_edit.html:311 +#: surveybox/web/templates/question_edit.html:312 msgid "Remove subtitles" msgstr "" -#: surveybox/web/templates/question_edit.html:321 -#: surveybox/web/templates/question_edit.html:357 +#: surveybox/web/templates/question_edit.html:322 +#: surveybox/web/templates/question_edit.html:358 msgid "External video" msgstr "" -#: surveybox/web/templates/question_edit.html:327 +#: surveybox/web/templates/question_edit.html:328 msgid "Add image" msgstr "" -#: surveybox/web/templates/question_edit.html:328 +#: surveybox/web/templates/question_edit.html:329 msgid "Image" msgstr "" -#: surveybox/web/templates/question_edit.html:331 +#: surveybox/web/templates/question_edit.html:332 #, python-format msgid "" "JPEG, PNG or WebP, at most %(n)s MB. Surveybox removes metadata such as " "location and shrinks large images." msgstr "" -#: surveybox/web/templates/question_edit.html:332 +#: surveybox/web/templates/question_edit.html:333 msgid "Upload image" msgstr "" -#: surveybox/web/templates/question_edit.html:338 +#: surveybox/web/templates/question_edit.html:339 msgid "Change video" msgstr "" -#: surveybox/web/templates/question_edit.html:338 +#: surveybox/web/templates/question_edit.html:339 msgid "Upload video" msgstr "" -#: surveybox/web/templates/question_edit.html:339 +#: surveybox/web/templates/question_edit.html:340 #, python-format msgid "Video file (MP4 or WebM, at most %(n)s MB)" msgstr "" -#: surveybox/web/templates/question_edit.html:341 +#: surveybox/web/templates/question_edit.html:342 msgid "Preview image (optional)" msgstr "" -#: surveybox/web/templates/question_edit.html:343 +#: surveybox/web/templates/question_edit.html:344 msgid "Subtitles as WebVTT file (optional)" msgstr "" -#: surveybox/web/templates/question_edit.html:345 +#: surveybox/web/templates/question_edit.html:346 msgid "Language of the subtitles" msgstr "" -#: surveybox/web/templates/question_edit.html:349 -#: surveybox/web/templates/question_edit.html:360 +#: surveybox/web/templates/question_edit.html:350 +#: surveybox/web/templates/question_edit.html:361 msgid "Title for screen readers (optional)" msgstr "" -#: surveybox/web/templates/question_edit.html:351 +#: surveybox/web/templates/question_edit.html:352 msgid "Save video" msgstr "" -#: surveybox/web/templates/question_edit.html:358 +#: surveybox/web/templates/question_edit.html:359 msgid "Address of the video" msgstr "" -#: surveybox/web/templates/question_edit.html:362 +#: surveybox/web/templates/question_edit.html:363 msgid "" "Participants load the video only after a click and a notice that data is " "sent to the provider." msgstr "" -#: surveybox/web/templates/question_edit.html:363 +#: surveybox/web/templates/question_edit.html:364 msgid "Embed video" msgstr "" -#: surveybox/web/templates/question_edit.html:370 +#: surveybox/web/templates/question_edit.html:371 msgid "Remove all images and videos" msgstr "" -#: surveybox/web/templates/question_edit.html:378 -#: surveybox/web/templates/question_edit.html:385 +#: surveybox/web/templates/question_edit.html:379 +#: surveybox/web/templates/question_edit.html:386 msgid "Delete question" msgstr "" -#: surveybox/web/templates/question_edit.html:383 +#: surveybox/web/templates/question_edit.html:384 #, python-format msgid "Also delete the %(num)d existing answer to this question" msgid_plural "Also delete the %(num)d existing answers to this question" @@ -7159,6 +7176,31 @@ msgid "" "person can move up:" msgstr "" +#: surveybox/web/templates/mail/proposed.txt:1 +#, python-format +msgid "New proposal: %(title)s" +msgstr "" + +#: surveybox/web/templates/mail/proposed.txt:4 +#, python-format +msgid "A participant has proposed a further option in “%(title)s”:" +msgid_plural "Participants have proposed further options in “%(title)s”:" +msgstr[0] "" +msgstr[1] "" + +#: surveybox/web/templates/mail/proposed.txt:11 +msgid "" +"You have already taken part. If you like, add your vote for the new " +"option to your answer: open your personal link from your confirmation " +"email. You can request it again here:" +msgstr "" + +#: surveybox/web/templates/mail/proposed.txt:14 +msgid "" +"You have already taken part. If you like, add your vote for the new " +"option to your answer:" +msgstr "" + #: surveybox/web/templates/mail/register.txt:1 #, python-format msgid "Create your account at %(app)s" diff --git a/surveybox/mail/custom.py b/surveybox/mail/custom.py index 6399907..9906075 100644 --- a/surveybox/mail/custom.py +++ b/surveybox/mail/custom.py @@ -46,6 +46,7 @@ KINDS: dict[str, str] = { "guest_export": N_("Guest: download own data"), "promoted": N_("Moved up from the waiting list"), "confirmed": N_("Date confirmed in a poll"), + "proposed": N_("New option proposed in a poll"), "changed": N_("Chosen entry or date removed"), "invitation": N_("Invitation to a form"), "reminder": N_("Reminder to invited people"), diff --git a/surveybox/mail/notify.py b/surveybox/mail/notify.py index ef0bd23..44de3a9 100644 --- a/surveybox/mail/notify.py +++ b/surveybox/mail/notify.py @@ -79,6 +79,8 @@ EVENTS: dict[str, Event] = { "participant"), "changed": Event(N_("An entry or date I chose has been removed from a form"), "participant"), + "proposed": Event(N_("Someone has proposed a new option in a poll I took part in"), + "participant"), "invitation": Event(N_("Invitation to a form"), "participant"), "reminder": Event(N_("Reminder about a form I was invited to"), "participant"), "comment_new": Event(N_("New comments on forms I manage"), "manager"), @@ -431,6 +433,54 @@ def dates_confirmed( return count +def options_proposed( + db: Session, settings: Settings, form: Form, author: Response, + proposed: Sequence[tuple[int, str]], +) -> int: + """Neue Vorschläge aus der Teilnehmerschaft an alle, die schon teilgenommen haben, + damit sie ihre Antwort ergänzen können. Nur, wenn sich Antworten noch ändern lassen; + nie an die Person, die vorgeschlagen hat, und nie bei anonymen Formularen.""" + if not proposed or form.anonymous or form.allow_edit != "until_close": + return 0 + from surveybox.forms import service, types + + if service.fill_state(form) != service.FillState.OPEN: + return 0 + questions = {q.id: q for q in form.questions} + options: list[dict[str, Any]] = [] + for question_id, option_id in proposed: + question = questions.get(question_id) + found = next((o for o in types.options_of(question) if o.get("id") == option_id), + None) if question is not None else None + if found is not None: + options.append(found) + if not options: + return 0 + responses = db.scalars( + select(Response).where( + Response.form_id == form.id, + Response.id != author.id, + (Response.user_id.is_not(None)) | (Response.guest_contact_id.is_not(None)), + ) + ).all() + me = _participant(db, settings, form, author) + recipients: dict[str, Recipient] = {} + for response in responses: + found_recipient = _participant(db, settings, form, response) + if found_recipient is not None and (me is None or found_recipient.ident != me.ident): + recipients.setdefault(found_recipient.ident, found_recipient) + key = ",".join(sorted(o["id"] for o in options)) + count = 0 + for ident in sorted(recipients): + if send( + db, settings, recipients[ident], kind="proposed", event="proposed", form=form, + context={"options": options, "link": form_link(settings, form)}, + dedupe_key=f"proposed:{form.id}:{key}:{ident}", + ): + count += 1 + return count + + def booking_events(db: Session, settings: Settings, form: Form, events: Any) -> None: """Nachgerückte Personen und ausgebuchte Einträge aus forms.booking.Events.""" by_question: dict[int, tuple[Question, list[Booking]]] = {} diff --git a/surveybox/web/routes/fill.py b/surveybox/web/routes/fill.py index fa21c96..6ac48d9 100644 --- a/surveybox/web/routes/fill.py +++ b/surveybox/web/routes/fill.py @@ -377,6 +377,7 @@ def submit_form( guests.confirm_url(settings, confirm) if confirm else None, ) notify.safely(db, notify.booking_events, settings, form, events) + notify.safely(db, notify.options_proposed, settings, form, response, validation.proposed) notify.safely(db, notify.participation_received, settings, form, response) notify.safely(db, followups.on_submit, settings, form, response) db.commit() @@ -595,6 +596,7 @@ def save_edit_for( ) uploads.link(db, form, own, _visible_files(collected, validation)) notify.safely(db, notify.booking_events, settings, form, events) + notify.safely(db, notify.options_proposed, settings, form, own, validation.proposed) return None diff --git a/surveybox/web/templates/mail/proposed.txt b/surveybox/web/templates/mail/proposed.txt new file mode 100644 index 0000000..5016445 --- /dev/null +++ b/surveybox/web/templates/mail/proposed.txt @@ -0,0 +1,16 @@ +{% set subject = _('New proposal: %(title)s', title=form.title) %} +{% if name %}{{ _('Hello %(name)s,', name=name) }}{% else %}{{ _('Hello,') }}{% endif %} + +{{ ngettext('A participant has proposed a further option in “%(title)s”:', 'Participants have proposed further options in “%(title)s”:', options | length, title=form.title) }} + +{% for option in options %} +- {{ option_text(option) }} +{% endfor %} + +{% if guest %} +{{ _('You have already taken part. If you like, add your vote for the new option to your answer: open your personal link from your confirmation email. You can request it again here:') }} +{{ links_url }} +{% else %} +{{ _('You have already taken part. If you like, add your vote for the new option to your answer:') }} +{{ link }} +{% endif %} diff --git a/surveybox/web/templates/question_edit.html b/surveybox/web/templates/question_edit.html index e15ccca..222e898 100644 --- a/surveybox/web/templates/question_edit.html +++ b/surveybox/web/templates/question_edit.html @@ -131,6 +131,7 @@ {{ check('allow_proposals', _('Participants may propose further options')) }} +

{{ _('A proposal counts as a “yes” from the person who made it. Everyone who has already taken part gets an email about it so they can add to their answer, provided participants may change their answer.') }}

{{ _('Dates') }}

{{ _('Only used when the options are dates. Time and duration are optional; without a time the date counts as a whole day.') }}

diff --git a/tests/test_mail_units.py b/tests/test_mail_units.py index f7734aa..60fb44d 100644 --- a/tests/test_mail_units.py +++ b/tests/test_mail_units.py @@ -101,6 +101,9 @@ CONTEXTS: dict[str, dict[str, Any]] = { "confirmed": {"options": [{"id": "a", "date": "2026-07-01", "time": None, "duration": None, "label": "Grill"}], "link": "https://umfrage.example/f/t", "calendar": None}, + "proposed": {"options": [{"id": "b", "date": "2026-07-02", "time": "18:30", + "duration": None, "label": "", "proposed": True}], + "link": "https://umfrage.example/f/t"}, "comment_new": {"pending": True, "link": "https://umfrage.example/forms/x/comments"}, "comment_published": {"link": "https://umfrage.example/f/t"}, "slot_full": {"entry": "Fr", "link": "https://umfrage.example/forms/x/responses"}, diff --git a/tests/test_proposals.py b/tests/test_proposals.py new file mode 100644 index 0000000..4d4585b --- /dev/null +++ b/tests/test_proposals.py @@ -0,0 +1,58 @@ +# SPDX-License-Identifier: AGPL-3.0-or-later +"""Neue Vorschläge in Abstimmungen: Hinweis an alle, die schon teilgenommen haben (CI).""" + +from __future__ import annotations + +from typing import Any + +import pytest + +pytest.importorskip("fastapi") + +from test_forms import creator, fill, participant, save_settings +from test_mail import messages +from test_phase5 import options_of, poll_form + +pytestmark = pytest.mark.db + + +def votes(qid: int, value: str = "yes") -> dict[str, str]: + return {f"q{qid}_{o['id']}": value for o in options_of(qid)} + + +def test_proposal_notifies_earlier_participants(app: Any) -> None: + owner = creator(app) + _, token, qid = poll_form(owner) + anna = participant(app, "anna-vorschlag@example.de") + bert = participant(app, "bert-vorschlag@example.de") + assert fill(anna, token, votes(qid)).status_code == 303 + assert messages("proposed") == [] + + # Bert schlägt beim Absenden einen weiteren Termin vor: Anna erfährt davon, Bert nicht + resp = fill(bert, token, {**votes(qid, "no"), f"q{qid}_propose_date": "2026-07-22", + f"q{qid}_propose_time": "18:00"}) + assert resp.status_code == 303 + sent = messages("proposed") + assert [m.recipient for m in sent] == ["anna-vorschlag@example.de"] + + # Anna ergänzt ihre Antwort um einen eigenen Vorschlag: jetzt erfährt es Bert + resp = fill(anna, token, {**votes(qid), f"q{qid}_propose_date": "2026-07-29"}, path="/edit") + assert resp.status_code == 303 + sent = messages("proposed") + assert sorted(m.recipient for m in sent) == ["anna-vorschlag@example.de", + "bert-vorschlag@example.de"] + # Ohne neuen Vorschlag keine weitere Mail + assert fill(anna, token, votes(qid), path="/edit").status_code == 303 + assert len(messages("proposed")) == 2 + + +def test_no_notice_when_answers_cannot_be_changed(app: Any) -> None: + owner = creator(app) + pid, token, qid = poll_form(owner) + assert save_settings(owner, pid, access="link", allow_edit="no").status_code == 303 + anna = participant(app, "anna-fest@example.de") + bert = participant(app, "bert-fest@example.de") + assert fill(anna, token, votes(qid)).status_code == 303 + assert fill(bert, token, {**votes(qid), f"q{qid}_propose_date": "2026-07-22"}).status_code \ + == 303 + assert messages("proposed") == []