feature:verlauf backup papierkorb
CI / audit (push) Skipped
CI / checks (push) Successful in 3m45s
CI / image (push) Successful in 1m11s

This commit is contained in:
marco.morath committed 2026-11-26 08:48:14 +01:00
1 parent 4cb6cd8cf9
commit 8b383d2552
41 files changed
+4369 -641

No files matched your search

+60
View File
@@ -567,6 +567,65 @@ Prüfsumme über das Formular und nichts zur Person). Bei sehr wenigen Antworten
lassen die Zahlen Rückschlüsse auf einzelne Personen zu; darauf weist die
Einstellung hin.
### Verlauf und Papierkorb
Neben den Komplettsicherungen (siehe Sicherungen) führt Surveybox für jedes
Formular einen eigenen Verlauf. Damit lassen sich versehentliche Änderungen
gezielt zurücknehmen, ohne den ganzen Bestand zurückzuspielen: Alles, was
inzwischen weiter ausgefüllt wurde, bleibt erhalten.
**Wann ein Stand entsteht:**
- bevor Fragen, Optionen, Bilder und Videos einer Frage, Einstellungen oder
die Freigabe geändert werden,
- bevor Verwaltende eine Antwort ändern oder löschen,
- einmal täglich (Worker), wenn sich am Formular oder seinen Antworten etwas
geändert hat,
- vor jeder Wiederherstellung (sie lässt sich so selbst zurücknehmen) und
beim Löschen des Formulars.
Wer mehrere Änderungen kurz hintereinander macht, bekommt nicht für jede einen
eigenen Stand: Innerhalb von 15 Minuten entsteht kein neuer, solange sich an
den Antworten nichts geändert hat. Weil einzeln wiederhergestellt wird, reicht
der Stand vom Beginn der Bearbeitung.
**Wiederherstellen:** im Designer unter *Verlauf* einen Stand wählen. Die Seite
zeigt, was sich seither unterscheidet und einzeln zurückholen lässt:
| Eintrag | Was zurückkommt |
| --- | --- |
| Einstellung | der damalige Wert (z. B. Titel, Enddatum, Löschfrist) |
| Freigabe | die damalige Liste der Personen und Gruppen |
| gelöschte Frage | die Frage an ihrem alten Platz mit allen Antworten, Buchungen und Dateien |
| gestrichene Option | die Option an ihrem alten Platz mit ihren Buchungen und ihrem Bild |
| geänderte Frage | Text, Pflicht und Einstellungen wie damals; heutige Optionen bleiben |
| von Verwaltenden gelöschte Antwort | die Antwort mit Buchungen, Vermerken und Dateien |
| von Verwaltenden geänderte Antwort | die damaligen Werte, mit Vermerk „Aus dem Verlauf wiederhergestellt“ |
Plätze werden dabei nicht geprüft. Reichen sie nicht mehr (der Platz einer
gelöschten Antwort ist inzwischen vergeben), sind alle Buchungen wieder da, die
Option ist **überbucht**: Designer, Verlauf und Antwortenseite weisen darauf
hin. Niemand rückt dabei auf die Warteliste.
Änderungen und Löschungen durch Teilnehmende selbst gelten als deren Wille und
werden nicht angeboten. Was Teilnehmende löschen, verschwindet sofort auch aus
allen Ständen; ebenso alles zu einer gelöschten Person (Konto oder
Gast-Adresse). Den Verlauf sehen und nutzen Eigentümer, Mitbearbeitende,
Gruppenadministratoren und Administratoren, nicht aber Auswertende.
**Papierkorb:** Ein gelöschtes Formular kommt in den Papierkorb unten in der
Formularliste und lässt sich dort mit allen Fragen, Antworten, Kommentaren und
Folge-Mails wiederherstellen. Das dürfen Eigentümer, wer gelöscht hat,
Gruppenadministratoren der Gruppe und Administratoren. Gibt es den Eigentümer
nicht mehr, übernimmt es, wer wiederherstellt.
**Aufbewahrung:** unter *Administration → Einstellungen → Verlauf und
Papierkorb*. Stände standardmäßig 90 Tage (1 bis 365), Papierkorb 14 Tage
(1 bis 90). Stände enthalten die Antworten und überdauern sie nie: Endet die
Löschfrist eines Formulars, entfallen auch seine Stände; ein endgültig
gelöschtes Formular nimmt seine Stände mit. Dateien, auf die ein Stand noch
verweist, bleiben so lange im Volume.
### Löschfristen
Antworten bleiben nicht unbegrenzt gespeichert. Die Frist beginnt mit dem Ende
@@ -619,6 +678,7 @@ Vor jeder Löschung zeigt eine Übersicht, was geschieht:
| Plätze in laufenden Formularen | freigegeben, die Warteliste rückt nach |
| Plätze in beendeten Formularen | bleiben beim Anonymisieren als anonyme Teilnahme gezählt |
| Kommentare eines Kontos | bleiben, Autor „Gelöschter Benutzer“ |
| Verlauf und Papierkorb | Antworten der Person entfernt; Formulare, die mit dem Konto gelöscht werden, samt Verlauf endgültig gelöscht |
| Protokoll | nur „Gelöschtes Konto Nr. …“, ohne Namen oder Adresse |
Gelöschte Daten bleiben bis zur Rotation in den Sicherungen. Jede Löschung
+1
View File
@@ -19,6 +19,7 @@ Einstellungen und das Vorgehen bei Störungen.
| Wann | Was | Wie |
| --- | --- | --- |
| täglich (automatisch) | Sicherung der Datenbank samt Dateiliste, Prüfung, Aufräumen | Worker ab `SURVEYBOX_BACKUP_HOUR`; Ergebnis unter *Protokoll* |
| täglich (automatisch) | Verlauf der Formulare: Stand für jedes geänderte Formular, abgelaufene Stände und Papierkorb-Einträge entfernen | Worker (Aufgabe `form_history`); Fristen unter *Administration → Einstellungen → Verlauf und Papierkorb* |
| stündlich (automatisch) | Löschfristen, abgelaufene Sitzungen, Tokens, unbestätigte Gast-Adressen, Mail-Warteschlange | Worker |
| wöchentlich | Sicherungen außerhalb des Hosts kopieren (`/data/backups`, inkl. `media/`) | eigener Backup-Job (z. B. Borgmatic) |
| wöchentlich (CI) | bekannte Lücken in Abhängigkeiten | CI-Job `audit`; bei Fund: `UPGRADE=1 scripts/lock.sh`, testen, ausliefern |
+29 -4
View File
@@ -18,7 +18,7 @@ oder seinem Datenschutzbeauftragten.
| Besondere Kategorien (Art. 9) | Keine vorgesehen. Wer Formulare mit solchen Fragen erstellt (z. B. Gesundheit, Unverträglichkeiten), prüft das je Formular und markiert die Fragen als personenbezogen |
| Empfänger | Innerhalb der Organisation: Verwalter und Auswertende des jeweiligen Formulars. Auftragsverarbeiter: [Betreiber des SMTP-Relays], [Hoster/Rechenzentrum, falls nicht selbst betrieben] |
| Drittland | Keine Übermittlung durch Surveybox. [Prüfen: SMTP-Relay, Hoster] |
| Löschfristen | Antworten: Löschfrist je Formular (Standard [730] Tage nach Ende), danach anonymisieren oder löschen; Konten: bis zur Löschung durch Admin oder Person selbst; Gast-Adressen ohne Bestätigung: 7 Tage; Protokoll: `SURVEYBOX_AUDIT_RETENTION_DAYS` (Standard 365 Tage); Mail-Warteschlange: nach Versand ohne Inhalt; Sicherungen: täglich `SURVEYBOX_BACKUP_KEEP_DAILY` Stück, Löschjournal sorgt nach dem Zurückspielen für erneutes Löschen |
| Löschfristen | Antworten: Löschfrist je Formular (Standard [730] Tage nach Ende), danach anonymisieren oder löschen; Konten: bis zur Löschung durch Admin oder Person selbst; Gast-Adressen ohne Bestätigung: 7 Tage; Protokoll: `SURVEYBOX_AUDIT_RETENTION_DAYS` (Standard 365 Tage); Mail-Warteschlange: nach Versand ohne Inhalt; Verlauf der Formulare (Stände mit Antworten zum punktuellen Wiederherstellen): [90] Tage, höchstens bis zum Ende der Löschfrist des Formulars; Papierkorb gelöschter Formulare: [14] Tage; Sicherungen: täglich `SURVEYBOX_BACKUP_KEEP_DAILY` Stück, Löschjournal sorgt nach dem Zurückspielen für erneutes Löschen |
| TOM | Siehe Abschnitt 3 und `docs/sicherheit.md` |
## 2. Rechtsgrundlagen (Anhaltspunkte)
@@ -39,7 +39,8 @@ oder seinem Datenschutzbeauftragten.
| Verfügbarkeit | Tägliche Sicherung mit Prüfung; Sicherung vor jedem Update; Update in einer Transaktion mit Rücksprung | Sicherungen (`/data/backups`) zusätzlich außerhalb des Hosts aufbewahren; Wiederherstellung jährlich proben |
| Belastbarkeit | Container ohne Root, schreibgeschützt, ohne Capabilities; Begrenzung von Anmeldeversuchen und Uploads | Host aktuell halten; Image nach Updates neu bauen |
| Datenminimierung | Anonyme Formulare ohne Bezug zur Person; Gast-Adressen nur mit Bestätigung; Adressen für Organisatoren unsichtbar, wenn das Formular es vorsieht; Exporte ohne personenbezogene Daten wählbar | Formulare sparsam gestalten; personenbezogene Fragen markieren |
| Löschung | Löschfristen je Formular; Löschen von Konten, Gästen und einzelnen Antworten mit Vorschau; Löschjournal für zurückgespielte Sicherungen | Löschfristen passend einstellen |
| Löschung | Löschfristen je Formular; Löschen von Konten, Gästen und einzelnen Antworten mit Vorschau; Löschjournal für zurückgespielte Sicherungen; Verlauf und Papierkorb mit eigener Frist, Löschungen durch Teilnehmende und gelöschte Personen sofort auch dort entfernt | Löschfristen, Verlauf und Papierkorb passend einstellen |
| Integrität (Fehlbedienung) | Verlauf je Formular: Stände vor Änderungen und täglich; einzelne Fragen, Optionen, Einstellungen und von Verwaltenden geänderte oder gelöschte Antworten wiederherstellbar; Papierkorb für gelöschte Formulare; jede Wiederherstellung im Protokoll | Verwaltende auf Verlauf und Papierkorb hinweisen |
## 4. Cookies und ähnliche Techniken
@@ -66,12 +67,33 @@ Ohne https (nur zum Testen) entfällt das Präfix `__Host-`.
| --- | --- |
| Auskunft, Übertragbarkeit (Art. 15, 20) | Konto → „Meine Daten herunterladen“ (JSON); Gäste über „Meine Links“ per Mail-Link oder über den persönlichen Link; Admins in der Benutzerverwaltung bzw. für Gast-Adressen |
| Berichtigung (Art. 16) | Eigene Antwort ändern (sofern das Formular es erlaubt) oder durch Verwalter mit Vermerk; Profil im Konto |
| Löschung (Art. 17) | Konto löschen (selbst oder durch Admin); Gäste über „Meine Links“ oder den persönlichen Link; einzelne Antworten durch Verwalter; Löschjournal wirkt auch nach dem Zurückspielen einer Sicherung |
| Löschung (Art. 17) | Konto löschen (selbst oder durch Admin); Gäste über „Meine Links“ oder den persönlichen Link; einzelne Antworten durch Verwalter; Löschjournal wirkt auch nach dem Zurückspielen einer Sicherung; was Betroffene selbst löschen und alles zu gelöschten Personen verschwindet sofort auch aus Verlauf und Papierkorb. Von Verwaltenden gelöschte Antworten bleiben dort bis zum Ablauf der Frist wiederherstellbar |
| Widerspruch, Widerruf (Art. 21, 7) | Benachrichtigungen im Konto oder per Abmeldelink abbestellen; Gast-Adresse widerrufen über „Meine Links“ |
Anfragen, die nicht über die Oberfläche gehen, beantwortet [Stelle] innerhalb
eines Monats; Auskunft und Löschung erledigt ein Administrator wie oben.
### Verlauf und Papierkorb
Stände sind Kopien des Formulars mit seinen Antworten. Sie dienen der
Integrität (Art. 32 Abs. 1 lit. b, c DSGVO): Fehlbedienungen lassen sich
gezielt zurücknehmen, ohne eine Komplettsicherung einzuspielen. Regeln:
- Aufbewahrung nach Instanzeinstellung (Standard 90 Tage, Papierkorb 14 Tage),
nie länger als die Antworten selbst: Mit der Löschfrist des Formulars
entfallen seine Stände, mit dem endgültigen Löschen eines Formulars ebenso.
- Gelöschte Personen (Konto, Gast-Adresse) und Antworten, die Teilnehmende
selbst löschen, werden sofort aus allen Ständen und dem Papierkorb entfernt
(auch nach dem Zurückspielen einer Sicherung, über das Löschjournal).
- Wiederherstellen dürfen nur Eigentümer, Mitbearbeitende,
Gruppenadministratoren und Administratoren; Auswertende nicht. Jede
Wiederherstellung steht im Protokoll.
- Ändert eine teilnehmende Person ihre Antwort selbst, kann die frühere
Fassung bis zum Ablauf der Frist in älteren Ständen liegen; sie wird aber
nie zur Wiederherstellung angeboten. Kommentare, Teilnahme-Merker und der
Versandstand der Folge-Mails stehen nur im Stand beim Löschen eines
Formulars (Papierkorb).
## 6. Baustein für die Datenschutzerklärung
> **Umfragen und Anmeldungen (Surveybox)**
@@ -88,7 +110,10 @@ eines Monats; Auskunft und Löschung erledigt ein Administrator wie oben.
> Zweck ist die Durchführung und Auswertung des jeweiligen Formulars;
> Rechtsgrundlage ist [Art. 6 Abs. 1 lit. … DSGVO]. Die Antworten sehen nur die
> für das Formular zuständigen Personen. Wir löschen oder anonymisieren
> Antworten [Frist] nach dem Ende des Formulars. Mails versenden wir über
> Antworten [Frist] nach dem Ende des Formulars. Zum Schutz vor Fehlbedienung
> bewahren wir frühere Stände eines Formulars mit seinen Antworten bis zu
> [90] Tage auf, längstens bis zu dieser Frist; was Sie selbst löschen,
> entfernen wir sofort auch dort. Mails versenden wir über
> [SMTP-Anbieter]. Surveybox setzt nur technisch notwendige Cookies (Anmeldung,
> Sprache, Schutz vor Missbrauch) und lädt keine Inhalte von Dritten.
>
+11 -7
View File
@@ -13,11 +13,11 @@ ausgefüllt.
| V1 | Architektur | Ein Image für Web und Worker, PostgreSQL, Volume `/data`; keine externen Dienste außer SMTP-Relay | Review |
| V2 | Authentisierung | Argon2id; Passkeys (WebAuthn); TOTP mit Wiederherstellungscodes; zweiter Faktor Pflicht für Administratoren; Sperre nach Fehlversuchen; Begrenzung je IP und Konto; „Passwort vergessen“ antwortet immer gleich | `test_accounts`, `test_passkeys_groups`, `test_mail` |
| V3 | Sitzungen | Zufällige Sitzungs-ID (serverseitig), Cookie `__Host-…` mit `Secure`, `HttpOnly`, `SameSite=Lax`; Leerlauf- und Höchstdauer; Abmelden auf allen Geräten; neue Sitzung nach Anmeldung | `test_accounts`, `test_security_matrix` |
| V4 | Zugriffskontrolle | Jede Anfrage prüft Rolle, Gruppe und Freigabe auf dem Server; Formular-IDs, Links und Tokens sind zufällig (UUID bzw. 128 Bit und mehr) | `test_security_matrix` (alle Routen), `test_group_scope`, `test_media_team` |
| V4 | Zugriffskontrolle | Jede Anfrage prüft Rolle, Gruppe und Freigabe auf dem Server; Formular-IDs, Links und Tokens sind zufällig (UUID bzw. 128 Bit und mehr); Verlauf nur ab Mitbearbeitung, Papierkorb nur für Eigentümer, Löschende, Gruppen- und Instanz-Admins | `test_security_matrix` (alle Routen), `test_group_scope`, `test_media_team`, `test_history` |
| V5 | Eingaben und Ausgaben | Typisierte Prüfung (FastAPI/Pydantic und eigene Prüfungen je Fragetyp); SQL nur über SQLAlchemy mit Parametern; Jinja mit automatischem Escaping; Mail- und Gestaltungsvorlagen ohne ausführbare Syntax; Exporte entschärfen Formeln (CSV), schreiben Text immer als Text (XLSX, ODS) und maskieren PDF-Markup | `test_question_types`, `test_xlsx_units`, `test_phase8c_units`, `test_mail_custom_units` |
| V6 | Kryptografie | Geheimnisse aus `SURVEYBOX_SECRET_KEY` abgeleitet (HKDF je Zweck); TOTP-Geheimnisse und SMTP-Passwort verschlüsselt; Mail-Inhalte in der Warteschlange verschlüsselt | `test_security_units`, `test_mail` |
| V7 | Fehler und Protokoll | Keine Stacktraces an Benutzer; Protokoll für Anmeldungen, Admin-Aktionen, Exporte, Löschungen, ohne Antwortinhalte; Aufbewahrung `SURVEYBOX_AUDIT_RETENTION_DAYS` | `test_audit_actions` |
| V8 | Datenschutz | Datensparsamkeit, Löschfristen, Löschjournal, Auskunft (Art. 15/20), keine externen Ressourcen, `Cache-Control: no-store` | `test_retention`, `test_erasure`, `test_subject_export` |
| V8 | Datenschutz | Datensparsamkeit, Löschfristen, Löschjournal, Auskunft (Art. 15/20), keine externen Ressourcen, `Cache-Control: no-store`; Verlauf und Papierkorb mit eigener Frist, nie länger als die Antworten, Löschungen durch Teilnehmende und gelöschte Personen sofort auch dort entfernt | `test_retention`, `test_erasure`, `test_subject_export`, `test_history` |
| V9 | Kommunikation | TLS am Reverse Proxy; HSTS; SMTP mit STARTTLS oder TLS | Konfiguration, ZAP |
| V10 | Schadcode | Feste Versionen mit Hashes (`requirements.lock`); `pip-audit` bei jedem Lauf und wöchentlich; Image-Scan mit Trivy | CI |
| V12 | Dateien | Typprüfung am Inhalt, Größenlimits, Speicherung außerhalb des Web-Pfads, Auslieferung nur nach Rechteprüfung, Bilder neu berechnet ohne Metadaten, kein SVG; Dokumente nur als Download mit `sandbox`-CSP | `test_media_units`, `test_form_files` |
@@ -80,8 +80,12 @@ produktive Instanz.
zurückspielen (`restore`), anmelden, Stichproben prüfen, Löschjournal wird
angewendet.
6. **Stichproben von Hand**:
- Anmelden mit falschem Passwort, bis die Sperre greift; Meldung verrät
nicht, ob das Konto existiert.
- Fünfmal mit falschem Passwort anmelden, dann mit dem richtigen: auch das
scheitert (Konto 15 Minuten gesperrt), im Protokoll steht „Konto
gesperrt“. Die Meldung ist bei falschem Passwort, gesperrtem und
unbekanntem Konto dieselbe – sie verrät nicht, ob das Konto existiert.
Nach 30 Fehlversuchen von derselben Adresse in 15 Minuten erscheint
„Zu viele Versuche“.
- Formular-Link eines Formulars mit Zugriff „Ausgewählte Benutzer“ als nicht
eingeladene Person öffnen: kein Zugriff.
- Antwort-ID einer fremden Antwort in die Adresse einsetzen: 404.
@@ -96,9 +100,9 @@ produktive Instanz.
| --- | --- | --- | --- | --- |
| 25.11.2026 | `bfe9712` | CI | bestanden | checks (467 Tests, ruff, mypy, pip-audit, Migrationen) und image (Installation, Update, Sicherung/Wiederherstellung, Trivy ohne Befund) |
| 26.11.2026 | Testinstanz | ZAP Baseline | bestanden | 0 FAIL, 61 PASS, 6 WARN – alle bewertet, siehe unten |
| | | Lasttest (95 %) | | |
| | | Update mit Daten | | |
| | | Wiederherstellung | | |
| 26.11.2026 | Testinstanz, 2 Web-Prozesse | Lasttest (95 %) | bestanden | 20 gleichzeitige Abrufe, je 100: `/` 142 ms, `/login` 169 ms, `/f/<token>` 179 ms; einzeln ~30 ms; ~270 Abrufe/s |
| 26.11.2026 | Testinstanz | Update mit Daten | bestanden mit Bemerkung | Neues Image (Debian-Updates, ohne pip) auf bestehende Daten: „Datenbank ist aktuell (0017_response_note)“, Formulare, Antworten, Gestaltung und Anmeldung unverändert. Kein Schemawechsel seit 0017; Migrationen mit Daten bei den Phasen-Updates erfolgt. Voller Weg mit `OLD_IMAGE` und Sicherung vor dem Update beim nächsten Release mit Migration |
| 26.11.2026 | Testinstanz | Wiederherstellung | bestanden | Manuelle Sicherung zurückgespielt: Stand der Sicherung vollständig (Formulare, Antworten, Medien, Gestaltung, Anmeldung); nach der Sicherung angelegtes Formular entfernt; nach der Sicherung gelöschtes Konto blieb durch das Löschjournal gelöscht |
| | | Stichproben | | |
### Bewertung ZAP Baseline (26.11.2026)
+3
View File
@@ -70,6 +70,9 @@ ACTIONS = {
"response.deleted",
"response.edited",
"guest.deleted",
"form.history_restored",
"form.trash_restored",
"admin.history_changed",
}
+2 -1
View File
@@ -163,7 +163,8 @@ def replay(db: Any, settings: Settings, since: datetime) -> int:
response = db.scalar(select(Response).where(Response.public_id == pid))
if response is None:
continue
erasure.delete_response(db, settings, response)
erasure.delete_response(db, settings, response,
by_manager=entry.extra.get("by") == "manager")
elif entry.kind == "retention":
form = db.scalar(select(Form).where(Form.public_id == pid))
if form is None:
+5
View File
@@ -47,6 +47,11 @@ class Availability:
def full(self) -> bool:
return self.capacity is not None and self.confirmed >= self.capacity
@property
def overbooked(self) -> bool:
"""Mehr bestätigt als Plätze (nach einer Wiederherstellung aus dem Verlauf)."""
return self.capacity is not None and self.confirmed > self.capacity
def _capacity(question: Question, option_id: str) -> int | None:
for option in types.options_of(question):
+16 -3
View File
@@ -20,7 +20,7 @@ from sqlalchemy import delete, select, update
from sqlalchemy.orm import Session
from surveybox.accounts import audit
from surveybox.forms import booking, retention
from surveybox.forms import booking, history, retention
from surveybox.forms.service import FillState, fill_state, participation_marker
from surveybox.models import (
Comment,
@@ -34,6 +34,7 @@ from surveybox.models import (
Response,
UserAccount,
)
from surveybox.security.tokens import derive_key, keyed_hash
from surveybox.settings import Settings
RUNNING = (FillState.OPEN, FillState.SCHEDULED)
@@ -117,10 +118,16 @@ def erase_responses(
return summary
def delete_response(db: Session, settings: Settings, response: Response) -> None:
"""Einzelne Antwort vollständig löschen (persönlicher Link); Plätze werden frei."""
def delete_response(
db: Session, settings: Settings, response: Response, *, by_manager: bool = False
) -> None:
"""Einzelne Antwort vollständig löschen; Plätze werden frei. Löscht die Person
sie selbst, verschwindet sie auch aus dem Verlauf; von Verwaltern gelöschte
Antworten bleiben dort wiederherstellbar."""
from surveybox.mail import notify
if not by_manager:
history.scrub_responses(db, response.form_id, [response.id])
form = db.get(Form, response.form_id)
if form is not None:
events = booking.Events()
@@ -191,6 +198,10 @@ def erase_user(
FormParticipation.form_id == form.id,
FormParticipation.marker == participation_marker(secret, form, user)))
transferred = removed = 0
history.scrub_user(
db, user.id, f"u:{user.public_id}",
lambda form_id: keyed_hash(derive_key(secret, "participation"), f"{form_id}:{user.id}"))
history.purge_owner_trash(db, user.id)
for form in owned_forms(db, user):
target = form_targets.get(form.id)
if target is not None and target.id != user.id:
@@ -199,6 +210,7 @@ def erase_user(
FormMember.form_id == form.id, FormMember.user_id == target.id))
transferred += 1
else:
history.purge_form(db, form.id)
db.delete(form)
removed += 1
summary.comments = int(db.execute(
@@ -236,6 +248,7 @@ def erase_guest(
) -> Summary:
"""Alles, was an einer Gast-Adresse hängt: Antworten, Versandstand, Mailprotokoll."""
now = now or datetime.now(UTC)
history.scrub_guest(db, contact.id, f"g:{contact.public_id}")
summary = erase_responses(db, settings, _guest_responses(db, contact), now)
db.execute(delete(FollowupDelivery).where(
FollowupDelivery.recipient == f"g:{contact.public_id}"))
File diff suppressed because it is too large. Load diff
+3 -1
View File
@@ -30,7 +30,7 @@ from sqlalchemy import delete, exists, select, update
from sqlalchemy.orm import Session
from surveybox.accounts import audit
from surveybox.forms import notes
from surveybox.forms import history, notes
from surveybox.models import (
Answer,
AppSetting,
@@ -204,6 +204,8 @@ def apply(db: Session, form: Form, now: datetime) -> int:
else anonymize_responses(db, form, ids, now)
)
_clear_form_traces(db, form, mode)
# Frist abgelaufen: auch die Stände im Verlauf enthalten die Antworten
history.purge_form(db, form.id)
audit.record(db, "form.retention_applied", target_type="form", target_id=str(form.public_id),
details={"mode": mode, "responses": count})
return count
+1
View File
@@ -795,6 +795,7 @@ def replace_answers(db: Session, response: Response, validation: Validation) ->
db.flush()
response.answers.extend(_answers(validation.stored))
response.updated_at = datetime.now(UTC)
response.edited_by = "participant" # Verwalter setzen danach "manager" (Verlauf)
def stored_of(answer: Answer) -> Stored:
+447 -110
View File
@@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Surveybox VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2026-11-25 16:57+0100\n"
"POT-Creation-Date: 2026-11-26 08:43+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: de\n"
@@ -82,7 +82,7 @@ msgid "Guest"
msgstr "Gast"
#: surveybox/forms/comments.py surveybox/web/templates/admin_audit.html
#: surveybox/web/templates/response_view.html
#: surveybox/web/templates/form_history.html surveybox/web/templates/response_view.html
msgid "Deleted user"
msgstr "Gelöschter Benutzer"
@@ -124,15 +124,16 @@ msgstr "Ungültige Regel (Frage fehlt oder steht nicht davor)"
#: surveybox/forms/conditions.py surveybox/forms/evaluation.py surveybox/forms/export.py
#: surveybox/forms/summary.py surveybox/forms/types.py surveybox/web/routes/forms.py
#: surveybox/web/templates/_fill_fields.html surveybox/web/templates/form_responses.html
#: surveybox/web/templates/results_public.html
#: surveybox/web/templates/_fill_fields.html surveybox/web/templates/form_history_compare.html
#: surveybox/web/templates/form_responses.html surveybox/web/templates/results_public.html
msgid "Yes"
msgstr "Ja"
#: surveybox/forms/conditions.py surveybox/forms/evaluation.py surveybox/forms/export.py
#: surveybox/forms/summary.py surveybox/forms/types.py surveybox/web/routes/forms.py
#: surveybox/web/templates/_fill_fields.html surveybox/web/templates/form_responses.html
#: surveybox/web/templates/form_settings.html surveybox/web/templates/results_public.html
#: surveybox/web/templates/_fill_fields.html surveybox/web/templates/form_history_compare.html
#: surveybox/web/templates/form_responses.html surveybox/web/templates/form_settings.html
#: surveybox/web/templates/results_public.html
msgid "No"
msgstr "Nein"
@@ -236,7 +237,8 @@ msgid "Page %(page)s of %(pages)s"
msgstr "Seite %(page)s von %(pages)s"
#: surveybox/forms/export.py surveybox/forms/pdf_export.py surveybox/web/templates/form_designer.html
#: surveybox/web/templates/form_responses.html surveybox/web/templates/forms_list.html
#: surveybox/web/templates/form_history_compare.html surveybox/web/templates/form_responses.html
#: surveybox/web/templates/forms_list.html
msgid "Answers"
msgstr "Antworten"
@@ -850,6 +852,18 @@ msgstr "Das Formular wurde gespeichert."
msgid "The form has been deleted."
msgstr "Das Formular wurde gelöscht."
#: surveybox/web/templating.py
msgid "The form has been moved to the trash. It can be restored there for a limited time."
msgstr "Das Formular liegt jetzt im Papierkorb. Dort lässt es sich eine Zeit lang wiederherstellen."
#: surveybox/web/templating.py
msgid "The form has been restored from the trash."
msgstr "Das Formular wurde aus dem Papierkorb wiederhergestellt."
#: surveybox/web/templating.py
msgid "The selected changes have been restored."
msgstr "Die ausgewählten Änderungen wurden wiederhergestellt."
#: surveybox/web/templating.py
msgid "The copy has been created. It is a draft."
msgstr "Die Kopie wurde angelegt. Sie ist ein Entwurf."
@@ -1106,6 +1120,18 @@ msgstr "Standard-Löschfrist geändert"
msgid "Retention period applied to a form"
msgstr "Löschfrist auf ein Formular angewendet"
#: surveybox/web/routes/admin.py
msgid "Changes restored from the form history"
msgstr "Änderungen aus dem Verlauf wiederhergestellt"
#: surveybox/web/routes/admin.py
msgid "Deleted form restored"
msgstr "Gelöschtes Formular wiederhergestellt"
#: surveybox/web/routes/admin.py
msgid "Form history settings changed"
msgstr "Einstellungen zu Verlauf und Papierkorb geändert"
#: surveybox/web/routes/admin.py
msgid "Account deleted"
msgstr "Konto gelöscht"
@@ -1447,6 +1473,145 @@ msgstr "an den Mailserver übergeben"
msgid "sending failed"
msgstr "Versand fehlgeschlagen"
#: surveybox/web/routes/form_history.py
msgid "Before a change to questions or settings"
msgstr "Vor einer Änderung an Fragen oder Einstellungen"
#: surveybox/web/routes/form_history.py
msgid "Before an answer was changed by a manager"
msgstr "Bevor eine Antwort durch Verwaltende geändert wurde"
#: surveybox/web/routes/form_history.py
msgid "Before an answer was deleted by a manager"
msgstr "Bevor eine Antwort durch Verwaltende gelöscht wurde"
#: surveybox/web/routes/form_history.py
msgid "Daily"
msgstr "Täglich"
#: surveybox/web/routes/form_history.py
msgid "Before a restore"
msgstr "Vor einer Wiederherstellung"
#: surveybox/web/routes/form_history.py
msgid "When the form was deleted"
msgstr "Beim Löschen des Formulars"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
#: surveybox/web/templates/forms_list.html
msgid "Title"
msgstr "Titel"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Description (optional)"
msgstr "Beschreibung (optional)"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Opens at (optional)"
msgstr "Öffnet am (optional)"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Closes at (optional)"
msgstr "Schließt am (optional)"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_access.html
#: surveybox/web/templates/form_designer.html surveybox/web/templates/form_settings.html
msgid "Who may fill in"
msgstr "Wer darf ausfüllen"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Password for access via link"
msgstr "Passwort für den Zugang per Link"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "A person may fill in the form several times"
msgstr "Eine Person darf das Formular mehrfach ausfüllen"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Participants may change their answer"
msgstr "Teilnehmende dürfen ihre Antwort ändern"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Email address of guests"
msgstr "E-Mail-Adresse von Gästen"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Participants see the results"
msgstr "Teilnehmende sehen die Ergebnisse"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Retention period in days after the end of the form"
msgstr "Löschfrist in Tagen nach Ende des Formulars"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "When the retention period ends or a participant is deleted"
msgstr "Wenn die Löschfrist abläuft oder eine Person gelöscht wird"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Privacy notice shown with the form (optional)"
msgstr "Datenschutzhinweis zum Formular (optional)"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Participants must give their consent"
msgstr "Teilnehmende müssen einwilligen"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Consent text"
msgstr "Einwilligungstext"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Show who has signed up"
msgstr "Eingetragene Namen anzeigen"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Places per person across all participation fields (empty: no limit)"
msgstr "Plätze je Person über alle Teilnahme-Felder (leer: unbegrenzt)"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Remind invited people who have not taken part yet … days before the end (empty: no reminder)"
msgstr "Eingeladene ohne Teilnahme … Tage vor dem Ende erinnern (leer: keine Erinnerung)"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Confirmed dates as calendar"
msgstr "Bestätigte Termine als Kalender"
#: surveybox/web/routes/form_history.py surveybox/web/templates/_comments.html
#: surveybox/web/templates/form_comments.html surveybox/web/templates/form_designer.html
#: surveybox/web/templates/form_settings.html
msgid "Comments"
msgstr "Kommentare"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Publish comments without the author’s name (managers still see it)"
msgstr "Kommentare ohne Namen veröffentlichen (Verwalter sehen ihn weiterhin)"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Reply-to address for messages about this form (optional)"
msgstr "Antwort-an-Adresse für Nachrichten zu diesem Formular (optional)"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Notify managers about new comments by email"
msgstr "Verwalter per E-Mail über neue Kommentare benachrichtigen"
#: surveybox/web/routes/form_history.py surveybox/web/templates/admin_audit.html
#: surveybox/web/templates/form_settings.html surveybox/web/templates/form_team.html
#: surveybox/web/templates/forms_list.html
msgid "Group"
msgstr "Gruppe"
#: surveybox/web/routes/form_history.py
msgid "Please choose at least one change to restore."
msgstr "Bitte wählen Sie mindestens eine Änderung zum Wiederherstellen."
#: surveybox/web/routes/form_history.py surveybox/web/routes/forms.py
msgid "This form can no longer be restored."
msgstr "Dieses Formular lässt sich nicht mehr wiederherstellen."
#: surveybox/web/routes/form_history.py
#, python-format
msgid "Restored from the form history (state of %(date)s)."
msgstr "Aus dem Verlauf wiederhergestellt (Stand vom %(date)s)."
#: surveybox/web/routes/form_results.py
msgid "Please describe why you change this answer."
msgstr "Bitte beschreiben Sie, warum Sie diese Antwort ändern."
@@ -1744,11 +1909,6 @@ msgstr "Zu dieser Adresse gibt es schon ein Konto. Bitte melden Sie sich an."
msgid "Registration is switched off."
msgstr "Die Registrierung ist abgeschaltet."
#: surveybox/web/templates/_comments.html surveybox/web/templates/form_comments.html
#: surveybox/web/templates/form_designer.html surveybox/web/templates/form_settings.html
msgid "Comments"
msgstr "Kommentare"
#: surveybox/web/templates/_comments.html
msgid "edited"
msgstr "bearbeitet"
@@ -2363,7 +2523,8 @@ msgstr "Gestaltung"
#: surveybox/web/templates/admin_appearance.html surveybox/web/templates/admin_settings.html
#: surveybox/web/templates/base.html surveybox/web/templates/form_designer.html
#: surveybox/web/templates/form_responses.html surveybox/web/templates/form_settings.html
#: surveybox/web/templates/form_history_compare.html surveybox/web/templates/form_responses.html
#: surveybox/web/templates/form_settings.html
msgid "Settings"
msgstr "Einstellungen"
@@ -2632,7 +2793,7 @@ msgstr ""
msgid "Action"
msgstr "Aktion"
#: surveybox/web/templates/admin_audit.html
#: surveybox/web/templates/admin_audit.html surveybox/web/templates/form_history.html
msgid "By"
msgstr "Durch"
@@ -2650,12 +2811,7 @@ msgstr "Gelöschtes Konto Nr. %(n)s"
msgid "Guest address no. %(n)s"
msgstr "Gast-Adresse Nr. %(n)s"
#: surveybox/web/templates/admin_audit.html surveybox/web/templates/form_settings.html
#: surveybox/web/templates/form_team.html surveybox/web/templates/forms_list.html
msgid "Group"
msgstr "Gruppe"
#: surveybox/web/templates/admin_audit.html
#: surveybox/web/templates/admin_audit.html surveybox/web/templates/form_history_compare.html
msgid "deleted"
msgstr "gelöscht"
@@ -3197,6 +3353,47 @@ msgstr ""
"gelöscht, je nach Einstellung des Formulars. Der Eigentümer erhält 14 Tage vorher einen Hinweis; "
"kommt der Hinweis später, vergehen bis zur Löschung mindestens 7 Tage."
#: surveybox/web/templates/admin_settings.html
msgid "Form history and trash"
msgstr "Verlauf und Papierkorb"
#: surveybox/web/templates/admin_settings.html
#, python-format
msgid "The history can be kept for %(a)d to %(b)d days, the trash for %(c)d to %(d)d days."
msgstr "Der Verlauf lässt sich %(a)d bis %(b)d Tage aufbewahren, der Papierkorb %(c)d bis %(d)d Tage."
#: surveybox/web/templates/admin_settings.html
msgid "Keep saved states of forms for … days"
msgstr "Gespeicherte Stände von Formularen … Tage aufbewahren"
#: surveybox/web/templates/admin_settings.html
msgid ""
"States are saved before changes to questions, options, settings and access, before managers "
"change or delete answers, and once a day if a form changed. Managers use them to restore "
"individual questions, options, settings or answers. They contain the answers, so they never "
"outlast them: when a form is deleted or its retention period ends, its states are deleted too."
msgstr ""
"Stände entstehen vor Änderungen an Fragen, Optionen, Einstellungen und Freigaben, bevor "
"Verwaltende Antworten ändern oder löschen, und einmal täglich, wenn sich ein Formular geändert "
"hat. Damit lassen sich einzelne Fragen, Optionen, Einstellungen oder Antworten wiederherstellen. "
"Sie enthalten die Antworten und überdauern sie deshalb nie: Wird ein Formular gelöscht oder endet"
" seine Löschfrist, werden auch seine Stände gelöscht."
#: surveybox/web/templates/admin_settings.html
msgid "Keep deleted forms in the trash for … days"
msgstr "Gelöschte Formulare … Tage im Papierkorb aufbewahren"
#: surveybox/web/templates/admin_settings.html
msgid ""
"During this time the owner, the person who deleted it, group administrators and administrators "
"can restore a deleted form with all questions and answers. Afterwards it is deleted for good. If "
"a person is deleted, their answers are also removed from the trash and the history at once."
msgstr ""
"In dieser Zeit können Eigentümer, wer gelöscht hat, Gruppenadministratoren und Administratoren "
"ein gelöschtes Formular mit allen Fragen und Antworten wiederherstellen. Danach ist es endgültig "
"gelöscht. Wird eine Person gelöscht, verschwinden ihre Antworten sofort auch aus Papierkorb und "
"Verlauf."
#: surveybox/web/templates/admin_user_delete.html surveybox/web/templates/admin_user_edit.html
msgid "Delete user"
msgstr "Benutzer löschen"
@@ -4003,11 +4200,6 @@ msgstr ""
msgid "Access"
msgstr "Zugang"
#: surveybox/web/templates/form_access.html surveybox/web/templates/form_designer.html
#: surveybox/web/templates/form_settings.html
msgid "Who may fill in"
msgstr "Wer darf ausfüllen"
#: surveybox/web/templates/form_access.html
msgid ""
"Choose groups and individual users. Members of a chosen group always have access, also if they "
@@ -4028,10 +4220,14 @@ msgstr "Freigeben"
msgid "All forms"
msgstr "Alle Formulare"
#: surveybox/web/templates/form_designer.html
#: surveybox/web/templates/form_designer.html surveybox/web/templates/forms_list.html
msgid "Template"
msgstr "Vorlage"
#: surveybox/web/templates/form_designer.html surveybox/web/templates/form_history.html
msgid "More places are booked than available:"
msgstr "Es sind mehr Plätze belegt als vorhanden:"
#: surveybox/web/templates/form_designer.html surveybox/web/templates/form_preview.html
msgid "Live preview"
msgstr "Live-Vorschau"
@@ -4040,6 +4236,11 @@ msgstr "Live-Vorschau"
msgid "Team"
msgstr "Team"
#: surveybox/web/templates/form_designer.html surveybox/web/templates/form_history.html
#: surveybox/web/templates/form_history_compare.html
msgid "History"
msgstr "Verlauf"
#: surveybox/web/templates/form_designer.html
#, python-format
msgid "%(num)d new"
@@ -4259,6 +4460,183 @@ msgstr[1] "%(num)d Personen"
msgid "No follow-up emails yet."
msgstr "Noch keine Folge-Mails."
#: surveybox/web/templates/form_history.html
msgid "Nobody was moved to the waiting list. Raise the number of places or contact the people concerned."
msgstr ""
"Niemand wurde auf die Warteliste verschoben. Erhöhen Sie die Zahl der Plätze oder wenden Sie sich"
" an die Betroffenen."
#: surveybox/web/templates/form_history.html
msgid ""
"Surveybox saves the state of this form before questions, options, settings or access are changed,"
" before a manager changes or deletes an answer, and once a day if anything changed. Choose a "
"state to see what differs from now and to restore individual questions, options, settings or "
"answers. Everything else stays as it is."
msgstr ""
"Surveybox speichert den Stand dieses Formulars, bevor Fragen, Optionen, Einstellungen oder "
"Freigaben geändert werden, bevor Verwaltende eine Antwort ändern oder löschen, und einmal "
"täglich, wenn sich etwas geändert hat. Wählen Sie einen Stand, um zu sehen, was sich seither "
"unterscheidet, und um einzelne Fragen, Optionen, Einstellungen oder Antworten wiederherzustellen."
" Alles andere bleibt, wie es ist."
#: surveybox/web/templates/form_history.html
#, python-format
msgid "States are kept for %(num)d day, at most as long as the answers themselves."
msgid_plural "States are kept for %(num)d days, at most as long as the answers themselves."
msgstr[0] "Stände werden %(num)d Tag aufbewahrt, höchstens so lange wie die Antworten selbst."
msgstr[1] "Stände werden %(num)d Tage aufbewahrt, höchstens so lange wie die Antworten selbst."
#: surveybox/web/templates/form_history.html
msgid ""
"Changes and deletions by participants themselves are not restored; what participants delete also "
"disappears from the history."
msgstr ""
"Änderungen und Löschungen durch Teilnehmende selbst werden nicht zurückgenommen; was Teilnehmende"
" löschen, verschwindet auch aus dem Verlauf."
#: surveybox/web/templates/form_history.html
msgid "Saved"
msgstr "Gespeichert"
#: surveybox/web/templates/form_history.html
msgid "Occasion"
msgstr "Anlass"
#: surveybox/web/templates/form_history.html
msgid "Compare"
msgstr "Vergleichen"
#: surveybox/web/templates/form_history.html
msgid "No states yet. The first one is saved with the next change."
msgstr "Noch keine Stände. Der erste entsteht mit der nächsten Änderung."
#: surveybox/web/templates/form_history_compare.html
msgid "empty"
msgstr "leer"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "State of %(date)s"
msgstr "Stand vom %(date)s"
#: surveybox/web/templates/form_history_compare.html
msgid "Nothing in this state differs from the form as it is now in a way that can be restored."
msgstr "In diesem Stand unterscheidet sich nichts vom heutigen Formular, das sich wiederherstellen ließe."
#: surveybox/web/templates/form_history_compare.html
msgid ""
"Choose what to restore. Only the chosen items change; questions, answers and settings that are "
"not chosen stay as they are now."
msgstr ""
"Wählen Sie, was wiederhergestellt werden soll. Nur das Ausgewählte ändert sich; nicht ausgewählte"
" Fragen, Antworten und Einstellungen bleiben, wie sie jetzt sind."
#: surveybox/web/templates/form_history_compare.html
msgid "Access for people and groups"
msgstr "Freigabe für Personen und Gruppen"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "Then: %(old)d entries, now: %(new)d entries"
msgstr "Damals: %(old)d Einträge, jetzt: %(new)d Einträge"
#: surveybox/web/templates/form_history_compare.html
msgid "Then"
msgstr "Damals"
#: surveybox/web/templates/form_history_compare.html
msgid "Now"
msgstr "Jetzt"
#: surveybox/web/templates/form_history_compare.html
msgid "changed"
msgstr "geändert"
#: surveybox/web/templates/form_history_compare.html
msgid "Questions and options"
msgstr "Fragen und Optionen"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "With %(num)d answer"
msgid_plural "With %(num)d answers"
msgstr[0] "Mit %(num)d Antwort"
msgstr[1] "Mit %(num)d Antworten"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "%(num)d booked place"
msgid_plural "%(num)d booked places"
msgstr[0] "%(num)d gebuchter Platz"
msgstr[1] "%(num)d gebuchte Plätze"
#: surveybox/web/templates/form_history_compare.html
msgid ""
"Text, settings and options as they were then. Options added since are kept; removed options are "
"listed separately."
msgstr ""
"Text, Einstellungen und Optionen wie damals. Seither hinzugekommene Optionen bleiben; gestrichene"
" Optionen stehen einzeln in der Liste."
#: surveybox/web/templates/form_history_compare.html
msgid "option removed"
msgstr "Option gestrichen"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "Question: %(question)s"
msgstr "Frage: %(question)s"
#: surveybox/web/templates/form_history_compare.html
msgid "Answer without name"
msgstr "Antwort ohne Namen"
#: surveybox/web/templates/form_history_compare.html
msgid "deleted by a manager"
msgstr "von Verwaltenden gelöscht"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "Submitted %(date)s"
msgstr "Abgegeben %(date)s"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "%(num)d answered question"
msgid_plural "%(num)d answered questions"
msgstr[0] "%(num)d beantwortete Frage"
msgstr[1] "%(num)d beantwortete Fragen"
#: surveybox/web/templates/form_history_compare.html
msgid "changed by a manager"
msgstr "von Verwaltenden geändert"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "Changed %(date)s"
msgstr "Geändert %(date)s"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "%(num)d question differs"
msgid_plural "%(num)d questions differ"
msgstr[0] "%(num)d Frage weicht ab"
msgstr[1] "%(num)d Fragen weichen ab"
#: surveybox/web/templates/form_history_compare.html
msgid ""
"Before restoring, the current state is saved too, so this step can be undone in the history. "
"Booked places are restored even if there are not enough places any more; the option is then shown"
" as overbooked."
msgstr ""
"Vor dem Wiederherstellen wird auch der jetzige Stand gespeichert; so lässt sich dieser Schritt im"
" Verlauf zurücknehmen. Gebuchte Plätze kommen auch dann zurück, wenn die Plätze nicht mehr "
"reichen; die Option wird dann als überbucht angezeigt."
#: surveybox/web/templates/form_history_compare.html
msgid "Restore selected"
msgstr "Ausgewähltes wiederherstellen"
#: surveybox/web/templates/form_preview.html
msgid "Phone"
msgstr "Handy"
@@ -4417,6 +4795,10 @@ msgstr "Eintrag"
msgid "Signed up"
msgstr "Eingetragen"
#: surveybox/web/templates/form_responses.html
msgid "overbooked"
msgstr "überbucht"
#: surveybox/web/templates/form_responses.html surveybox/web/templates/results_public.html
#, python-format
msgid "%(num)d waiting"
@@ -4507,22 +4889,6 @@ msgstr ""
msgid "General"
msgstr "Allgemein"
#: surveybox/web/templates/form_settings.html surveybox/web/templates/forms_list.html
msgid "Title"
msgstr "Titel"
#: surveybox/web/templates/form_settings.html
msgid "Description (optional)"
msgstr "Beschreibung (optional)"
#: surveybox/web/templates/form_settings.html
msgid "Opens at (optional)"
msgstr "Öffnet am (optional)"
#: surveybox/web/templates/form_settings.html
msgid "Closes at (optional)"
msgstr "Schließt am (optional)"
#: surveybox/web/templates/form_settings.html surveybox/web/templates/forms_list.html
msgid "no group (instance-wide)"
msgstr "keine Gruppe (instanzweit)"
@@ -4531,10 +4897,6 @@ msgstr "keine Gruppe (instanzweit)"
msgid "Group administrators of this group and the groups above manage the form too."
msgstr "Gruppenadministratoren dieser und der darüberliegenden Gruppen verwalten die Umfrage mit."
#: surveybox/web/templates/form_settings.html
msgid "Password for access via link"
msgstr "Passwort für den Zugang per Link"
#: surveybox/web/templates/form_settings.html
msgid "A password is set. Leave empty to keep it."
msgstr "Ein Passwort ist gesetzt. Leer lassen, um es zu behalten."
@@ -4551,18 +4913,10 @@ msgstr "Bei „ausgewählte Benutzer und Gruppen“ wählen Sie diese auf der n
msgid "Participation"
msgstr "Teilnahme"
#: surveybox/web/templates/form_settings.html
msgid "A person may fill in the form several times"
msgstr "Eine Person darf das Formular mehrfach ausfüllen"
#: surveybox/web/templates/form_settings.html
msgid "Anonymous: answers are stored without reference to the person"
msgstr "Anonym: Antworten werden ohne Personenbezug gespeichert"
#: surveybox/web/templates/form_settings.html
msgid "Participants may change their answer"
msgstr "Teilnehmende dürfen ihre Antwort ändern"
#: surveybox/web/templates/form_settings.html
msgid "Yes, until the form closes"
msgstr "Ja, bis das Formular schließt"
@@ -4573,10 +4927,6 @@ msgstr ""
"Für angemeldete Teilnehmende und für Gäste mit ihrem persönlichen Link; nicht bei anonymen "
"Formularen."
#: surveybox/web/templates/form_settings.html
msgid "Remind invited people who have not taken part yet … days before the end (empty: no reminder)"
msgstr "Eingeladene ohne Teilnahme … Tage vor dem Ende erinnern (leer: keine Erinnerung)"
#: surveybox/web/templates/form_settings.html
msgid ""
"Only for access “Selected users and groups” and with an end date. Each person gets the reminder "
@@ -4585,10 +4935,6 @@ msgstr ""
"Nur bei Zugriff „Ausgewählte Benutzer und Gruppen“ und mit Enddatum. Jede Person erhält die "
"Erinnerung einmal per E-Mail; abschalten kann sie das in ihrem Konto."
#: surveybox/web/templates/form_settings.html
msgid "Participants see the results"
msgstr "Teilnehmende sehen die Ergebnisse"
#: surveybox/web/templates/form_settings.html
msgid "Never"
msgstr "Nie"
@@ -4618,14 +4964,6 @@ msgstr ""
msgid "Places, calendar and comments"
msgstr "Plätze, Kalender und Kommentare"
#: surveybox/web/templates/form_settings.html
msgid "Places per person across all participation fields (empty: no limit)"
msgstr "Plätze je Person über alle Teilnahme-Felder (leer: unbegrenzt)"
#: surveybox/web/templates/form_settings.html
msgid "Show who has signed up"
msgstr "Eingetragene Namen anzeigen"
#: surveybox/web/templates/form_settings.html
msgid "Yes, first name and initial of the last name"
msgstr "Ja, Vorname und Anfangsbuchstabe des Nachnamens"
@@ -4645,10 +4983,6 @@ msgstr ""
"Adressen werden nie angezeigt. Das Formular weist die Teilnehmenden darauf hin. Nicht bei "
"anonymen Formularen."
#: surveybox/web/templates/form_settings.html
msgid "Confirmed dates as calendar"
msgstr "Bestätigte Termine als Kalender"
#: surveybox/web/templates/form_settings.html
msgid "Off"
msgstr "Aus"
@@ -4677,18 +5011,6 @@ msgstr "Moderiert: neue Kommentare sind nach Freigabe sichtbar"
msgid "Public: new comments are visible at once"
msgstr "Öffentlich: neue Kommentare sind sofort sichtbar"
#: surveybox/web/templates/form_settings.html
msgid "Publish comments without the author’s name (managers still see it)"
msgstr "Kommentare ohne Namen veröffentlichen (Verwalter sehen ihn weiterhin)"
#: surveybox/web/templates/form_settings.html
msgid "Notify managers about new comments by email"
msgstr "Verwalter per E-Mail über neue Kommentare benachrichtigen"
#: surveybox/web/templates/form_settings.html
msgid "Reply-to address for messages about this form (optional)"
msgstr "Antwort-an-Adresse für Nachrichten zu diesem Formular (optional)"
#: surveybox/web/templates/form_settings.html
msgid ""
"Replies to messages about this form go to this address. Empty: the address from the email "
@@ -4701,22 +5023,6 @@ msgstr ""
msgid "Data protection"
msgstr "Datenschutz"
#: surveybox/web/templates/form_settings.html
msgid "Privacy notice shown with the form (optional)"
msgstr "Datenschutzhinweis zum Formular (optional)"
#: surveybox/web/templates/form_settings.html
msgid "Participants must give their consent"
msgstr "Teilnehmende müssen einwilligen"
#: surveybox/web/templates/form_settings.html
msgid "Consent text"
msgstr "Einwilligungstext"
#: surveybox/web/templates/form_settings.html
msgid "Retention period in days after the end of the form"
msgstr "Löschfrist in Tagen nach Ende des Formulars"
#: surveybox/web/templates/form_settings.html
#, python-format
msgid ""
@@ -4736,10 +5042,6 @@ msgstr "Die Antworten werden am %(date)s gelöscht."
msgid "The answers will be anonymized on %(date)s."
msgstr "Die Antworten werden am %(date)s anonymisiert."
#: surveybox/web/templates/form_settings.html
msgid "When the retention period ends or a participant is deleted"
msgstr "Wenn die Löschfrist abläuft oder eine Person gelöscht wird"
#: surveybox/web/templates/form_settings.html
msgid "Keep the answer anonymized"
msgstr "Antwort anonymisiert behalten"
@@ -4748,10 +5050,6 @@ msgstr "Antwort anonymisiert behalten"
msgid "Delete the answer completely"
msgstr "Antwort vollständig löschen"
#: surveybox/web/templates/form_settings.html
msgid "Email address of guests"
msgstr "E-Mail-Adresse von Gästen"
#: surveybox/web/templates/form_settings.html surveybox/web/templates/question_edit.html
msgid "Do not ask"
msgstr "Nicht abfragen"
@@ -4813,6 +5111,21 @@ msgstr "Link erneuern"
msgid "Delete form"
msgstr "Formular löschen"
#: surveybox/web/templates/form_settings.html
#, python-format
msgid ""
"The form goes to the trash in the form list. There you can restore it for %(num)d day; after that"
" it is deleted for good."
msgid_plural ""
"The form goes to the trash in the form list. There you can restore it for %(num)d days; after "
"that it is deleted for good."
msgstr[0] ""
"Das Formular kommt in den Papierkorb in der Formularliste. Dort lässt es sich %(num)d Tag lang "
"wiederherstellen; danach ist es endgültig gelöscht."
msgstr[1] ""
"Das Formular kommt in den Papierkorb in der Formularliste. Dort lässt es sich %(num)d Tage lang "
"wiederherstellen; danach ist es endgültig gelöscht."
#: surveybox/web/templates/form_settings.html
msgid "Yes, delete this form with all questions and answers."
msgstr "Ja, dieses Formular mit allen Fragen und Antworten löschen."
@@ -4853,6 +5166,30 @@ msgstr "Mitbearbeitung"
msgid "No forms yet."
msgstr "Noch keine Formulare."
#: surveybox/web/templates/forms_list.html
msgid "Trash"
msgstr "Papierkorb"
#: surveybox/web/templates/forms_list.html
msgid ""
"Deleted forms can be restored with all questions and answers until the date shown. After that "
"they are deleted for good."
msgstr ""
"Gelöschte Formulare lassen sich bis zum angegebenen Datum mit allen Fragen und Antworten "
"wiederherstellen. Danach sind sie endgültig gelöscht."
#: surveybox/web/templates/forms_list.html
msgid "Deleted"
msgstr "Gelöscht"
#: surveybox/web/templates/forms_list.html
msgid "Restorable until"
msgstr "Wiederherstellbar bis"
#: surveybox/web/templates/forms_list.html
msgid "Restore"
msgstr "Wiederherstellen"
#: surveybox/web/templates/forms_list.html
msgid "Templates"
msgstr "Vorlagen"
+442 -110
View File
@@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Surveybox VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2026-11-25 16:57+0100\n"
"POT-Creation-Date: 2026-11-26 08:43+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: en\n"
@@ -82,7 +82,7 @@ msgid "Guest"
msgstr "Guest"
#: surveybox/forms/comments.py surveybox/web/templates/admin_audit.html
#: surveybox/web/templates/response_view.html
#: surveybox/web/templates/form_history.html surveybox/web/templates/response_view.html
msgid "Deleted user"
msgstr "Deleted user"
@@ -124,15 +124,16 @@ msgstr "Invalid rule (question missing or not earlier)"
#: surveybox/forms/conditions.py surveybox/forms/evaluation.py surveybox/forms/export.py
#: surveybox/forms/summary.py surveybox/forms/types.py surveybox/web/routes/forms.py
#: surveybox/web/templates/_fill_fields.html surveybox/web/templates/form_responses.html
#: surveybox/web/templates/results_public.html
#: surveybox/web/templates/_fill_fields.html surveybox/web/templates/form_history_compare.html
#: surveybox/web/templates/form_responses.html surveybox/web/templates/results_public.html
msgid "Yes"
msgstr "Yes"
#: surveybox/forms/conditions.py surveybox/forms/evaluation.py surveybox/forms/export.py
#: surveybox/forms/summary.py surveybox/forms/types.py surveybox/web/routes/forms.py
#: surveybox/web/templates/_fill_fields.html surveybox/web/templates/form_responses.html
#: surveybox/web/templates/form_settings.html surveybox/web/templates/results_public.html
#: surveybox/web/templates/_fill_fields.html surveybox/web/templates/form_history_compare.html
#: surveybox/web/templates/form_responses.html surveybox/web/templates/form_settings.html
#: surveybox/web/templates/results_public.html
msgid "No"
msgstr "No"
@@ -236,7 +237,8 @@ msgid "Page %(page)s of %(pages)s"
msgstr "Page %(page)s of %(pages)s"
#: surveybox/forms/export.py surveybox/forms/pdf_export.py surveybox/web/templates/form_designer.html
#: surveybox/web/templates/form_responses.html surveybox/web/templates/forms_list.html
#: surveybox/web/templates/form_history_compare.html surveybox/web/templates/form_responses.html
#: surveybox/web/templates/forms_list.html
msgid "Answers"
msgstr "Answers"
@@ -850,6 +852,18 @@ msgstr "The form has been saved."
msgid "The form has been deleted."
msgstr "The form has been deleted."
#: surveybox/web/templating.py
msgid "The form has been moved to the trash. It can be restored there for a limited time."
msgstr "The form has been moved to the trash. It can be restored there for a limited time."
#: surveybox/web/templating.py
msgid "The form has been restored from the trash."
msgstr "The form has been restored from the trash."
#: surveybox/web/templating.py
msgid "The selected changes have been restored."
msgstr "The selected changes have been restored."
#: surveybox/web/templating.py
msgid "The copy has been created. It is a draft."
msgstr "The copy has been created. It is a draft."
@@ -1104,6 +1118,18 @@ msgstr "Default retention period changed"
msgid "Retention period applied to a form"
msgstr "Retention period applied to a form"
#: surveybox/web/routes/admin.py
msgid "Changes restored from the form history"
msgstr "Changes restored from the form history"
#: surveybox/web/routes/admin.py
msgid "Deleted form restored"
msgstr "Deleted form restored"
#: surveybox/web/routes/admin.py
msgid "Form history settings changed"
msgstr "Form history settings changed"
#: surveybox/web/routes/admin.py
msgid "Account deleted"
msgstr "Account deleted"
@@ -1445,6 +1471,145 @@ msgstr "handed to the mail server"
msgid "sending failed"
msgstr "sending failed"
#: surveybox/web/routes/form_history.py
msgid "Before a change to questions or settings"
msgstr "Before a change to questions or settings"
#: surveybox/web/routes/form_history.py
msgid "Before an answer was changed by a manager"
msgstr "Before an answer was changed by a manager"
#: surveybox/web/routes/form_history.py
msgid "Before an answer was deleted by a manager"
msgstr "Before an answer was deleted by a manager"
#: surveybox/web/routes/form_history.py
msgid "Daily"
msgstr "Daily"
#: surveybox/web/routes/form_history.py
msgid "Before a restore"
msgstr "Before a restore"
#: surveybox/web/routes/form_history.py
msgid "When the form was deleted"
msgstr "When the form was deleted"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
#: surveybox/web/templates/forms_list.html
msgid "Title"
msgstr "Title"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Description (optional)"
msgstr "Description (optional)"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Opens at (optional)"
msgstr "Opens at (optional)"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Closes at (optional)"
msgstr "Closes at (optional)"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_access.html
#: surveybox/web/templates/form_designer.html surveybox/web/templates/form_settings.html
msgid "Who may fill in"
msgstr "Who may fill in"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Password for access via link"
msgstr "Password for access via link"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "A person may fill in the form several times"
msgstr "A person may fill in the form several times"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Participants may change their answer"
msgstr "Participants may change their answer"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Email address of guests"
msgstr "Email address of guests"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Participants see the results"
msgstr "Participants see the results"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Retention period in days after the end of the form"
msgstr "Retention period in days after the end of the form"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "When the retention period ends or a participant is deleted"
msgstr "When the retention period ends or a participant is deleted"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Privacy notice shown with the form (optional)"
msgstr "Privacy notice shown with the form (optional)"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Participants must give their consent"
msgstr "Participants must give their consent"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Consent text"
msgstr "Consent text"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Show who has signed up"
msgstr "Show who has signed up"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Places per person across all participation fields (empty: no limit)"
msgstr "Places per person across all participation fields (empty: no limit)"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Remind invited people who have not taken part yet … days before the end (empty: no reminder)"
msgstr "Remind invited people who have not taken part yet … days before the end (empty: no reminder)"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Confirmed dates as calendar"
msgstr "Confirmed dates as calendar"
#: surveybox/web/routes/form_history.py surveybox/web/templates/_comments.html
#: surveybox/web/templates/form_comments.html surveybox/web/templates/form_designer.html
#: surveybox/web/templates/form_settings.html
msgid "Comments"
msgstr "Comments"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Publish comments without the author’s name (managers still see it)"
msgstr "Publish comments without the author’s name (managers still see it)"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Reply-to address for messages about this form (optional)"
msgstr "Reply-to address for messages about this form (optional)"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Notify managers about new comments by email"
msgstr "Notify managers about new comments by email"
#: surveybox/web/routes/form_history.py surveybox/web/templates/admin_audit.html
#: surveybox/web/templates/form_settings.html surveybox/web/templates/form_team.html
#: surveybox/web/templates/forms_list.html
msgid "Group"
msgstr "Group"
#: surveybox/web/routes/form_history.py
msgid "Please choose at least one change to restore."
msgstr "Please choose at least one change to restore."
#: surveybox/web/routes/form_history.py surveybox/web/routes/forms.py
msgid "This form can no longer be restored."
msgstr "This form can no longer be restored."
#: surveybox/web/routes/form_history.py
#, python-format
msgid "Restored from the form history (state of %(date)s)."
msgstr "Restored from the form history (state of %(date)s)."
#: surveybox/web/routes/form_results.py
msgid "Please describe why you change this answer."
msgstr "Please describe why you change this answer."
@@ -1738,11 +1903,6 @@ msgstr "There already is an account with this address. Please sign in."
msgid "Registration is switched off."
msgstr "Registration is switched off."
#: surveybox/web/templates/_comments.html surveybox/web/templates/form_comments.html
#: surveybox/web/templates/form_designer.html surveybox/web/templates/form_settings.html
msgid "Comments"
msgstr "Comments"
#: surveybox/web/templates/_comments.html
msgid "edited"
msgstr "edited"
@@ -2354,7 +2514,8 @@ msgstr "Design"
#: surveybox/web/templates/admin_appearance.html surveybox/web/templates/admin_settings.html
#: surveybox/web/templates/base.html surveybox/web/templates/form_designer.html
#: surveybox/web/templates/form_responses.html surveybox/web/templates/form_settings.html
#: surveybox/web/templates/form_history_compare.html surveybox/web/templates/form_responses.html
#: surveybox/web/templates/form_settings.html
msgid "Settings"
msgstr "Settings"
@@ -2616,7 +2777,7 @@ msgstr "Sign-ins and administrative actions. Contains no form content, email add
msgid "Action"
msgstr "Action"
#: surveybox/web/templates/admin_audit.html
#: surveybox/web/templates/admin_audit.html surveybox/web/templates/form_history.html
msgid "By"
msgstr "By"
@@ -2634,12 +2795,7 @@ msgstr "Deleted account no. %(n)s"
msgid "Guest address no. %(n)s"
msgstr "Guest address no. %(n)s"
#: surveybox/web/templates/admin_audit.html surveybox/web/templates/form_settings.html
#: surveybox/web/templates/form_team.html surveybox/web/templates/forms_list.html
msgid "Group"
msgstr "Group"
#: surveybox/web/templates/admin_audit.html
#: surveybox/web/templates/admin_audit.html surveybox/web/templates/form_history_compare.html
msgid "deleted"
msgstr "deleted"
@@ -3177,6 +3333,45 @@ msgstr ""
"as set in the form. The owner is notified 14 days before; if the notice comes later, at least 7 "
"days pass before anything is deleted."
#: surveybox/web/templates/admin_settings.html
msgid "Form history and trash"
msgstr "Form history and trash"
#: surveybox/web/templates/admin_settings.html
#, python-format
msgid "The history can be kept for %(a)d to %(b)d days, the trash for %(c)d to %(d)d days."
msgstr "The history can be kept for %(a)d to %(b)d days, the trash for %(c)d to %(d)d days."
#: surveybox/web/templates/admin_settings.html
msgid "Keep saved states of forms for … days"
msgstr "Keep saved states of forms for … days"
#: surveybox/web/templates/admin_settings.html
msgid ""
"States are saved before changes to questions, options, settings and access, before managers "
"change or delete answers, and once a day if a form changed. Managers use them to restore "
"individual questions, options, settings or answers. They contain the answers, so they never "
"outlast them: when a form is deleted or its retention period ends, its states are deleted too."
msgstr ""
"States are saved before changes to questions, options, settings and access, before managers "
"change or delete answers, and once a day if a form changed. Managers use them to restore "
"individual questions, options, settings or answers. They contain the answers, so they never "
"outlast them: when a form is deleted or its retention period ends, its states are deleted too."
#: surveybox/web/templates/admin_settings.html
msgid "Keep deleted forms in the trash for … days"
msgstr "Keep deleted forms in the trash for … days"
#: surveybox/web/templates/admin_settings.html
msgid ""
"During this time the owner, the person who deleted it, group administrators and administrators "
"can restore a deleted form with all questions and answers. Afterwards it is deleted for good. If "
"a person is deleted, their answers are also removed from the trash and the history at once."
msgstr ""
"During this time the owner, the person who deleted it, group administrators and administrators "
"can restore a deleted form with all questions and answers. Afterwards it is deleted for good. If "
"a person is deleted, their answers are also removed from the trash and the history at once."
#: surveybox/web/templates/admin_user_delete.html surveybox/web/templates/admin_user_edit.html
msgid "Delete user"
msgstr "Delete user"
@@ -3973,11 +4168,6 @@ msgstr ""
msgid "Access"
msgstr "Access"
#: surveybox/web/templates/form_access.html surveybox/web/templates/form_designer.html
#: surveybox/web/templates/form_settings.html
msgid "Who may fill in"
msgstr "Who may fill in"
#: surveybox/web/templates/form_access.html
msgid ""
"Choose groups and individual users. Members of a chosen group always have access, also if they "
@@ -3998,10 +4188,14 @@ msgstr "Approve"
msgid "All forms"
msgstr "All forms"
#: surveybox/web/templates/form_designer.html
#: surveybox/web/templates/form_designer.html surveybox/web/templates/forms_list.html
msgid "Template"
msgstr "Template"
#: surveybox/web/templates/form_designer.html surveybox/web/templates/form_history.html
msgid "More places are booked than available:"
msgstr "More places are booked than available:"
#: surveybox/web/templates/form_designer.html surveybox/web/templates/form_preview.html
msgid "Live preview"
msgstr "Live preview"
@@ -4010,6 +4204,11 @@ msgstr "Live preview"
msgid "Team"
msgstr "Team"
#: surveybox/web/templates/form_designer.html surveybox/web/templates/form_history.html
#: surveybox/web/templates/form_history_compare.html
msgid "History"
msgstr "History"
#: surveybox/web/templates/form_designer.html
#, python-format
msgid "%(num)d new"
@@ -4229,6 +4428,180 @@ msgstr[1] "%(num)d people"
msgid "No follow-up emails yet."
msgstr "No follow-up emails yet."
#: surveybox/web/templates/form_history.html
msgid "Nobody was moved to the waiting list. Raise the number of places or contact the people concerned."
msgstr "Nobody was moved to the waiting list. Raise the number of places or contact the people concerned."
#: surveybox/web/templates/form_history.html
msgid ""
"Surveybox saves the state of this form before questions, options, settings or access are changed,"
" before a manager changes or deletes an answer, and once a day if anything changed. Choose a "
"state to see what differs from now and to restore individual questions, options, settings or "
"answers. Everything else stays as it is."
msgstr ""
"Surveybox saves the state of this form before questions, options, settings or access are changed,"
" before a manager changes or deletes an answer, and once a day if anything changed. Choose a "
"state to see what differs from now and to restore individual questions, options, settings or "
"answers. Everything else stays as it is."
#: surveybox/web/templates/form_history.html
#, python-format
msgid "States are kept for %(num)d day, at most as long as the answers themselves."
msgid_plural "States are kept for %(num)d days, at most as long as the answers themselves."
msgstr[0] "States are kept for %(num)d day, at most as long as the answers themselves."
msgstr[1] "States are kept for %(num)d days, at most as long as the answers themselves."
#: surveybox/web/templates/form_history.html
msgid ""
"Changes and deletions by participants themselves are not restored; what participants delete also "
"disappears from the history."
msgstr ""
"Changes and deletions by participants themselves are not restored; what participants delete also "
"disappears from the history."
#: surveybox/web/templates/form_history.html
msgid "Saved"
msgstr "Saved"
#: surveybox/web/templates/form_history.html
msgid "Occasion"
msgstr "Occasion"
#: surveybox/web/templates/form_history.html
msgid "Compare"
msgstr "Compare"
#: surveybox/web/templates/form_history.html
msgid "No states yet. The first one is saved with the next change."
msgstr "No states yet. The first one is saved with the next change."
#: surveybox/web/templates/form_history_compare.html
msgid "empty"
msgstr "empty"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "State of %(date)s"
msgstr "State of %(date)s"
#: surveybox/web/templates/form_history_compare.html
msgid "Nothing in this state differs from the form as it is now in a way that can be restored."
msgstr "Nothing in this state differs from the form as it is now in a way that can be restored."
#: surveybox/web/templates/form_history_compare.html
msgid ""
"Choose what to restore. Only the chosen items change; questions, answers and settings that are "
"not chosen stay as they are now."
msgstr ""
"Choose what to restore. Only the chosen items change; questions, answers and settings that are "
"not chosen stay as they are now."
#: surveybox/web/templates/form_history_compare.html
msgid "Access for people and groups"
msgstr "Access for people and groups"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "Then: %(old)d entries, now: %(new)d entries"
msgstr "Then: %(old)d entries, now: %(new)d entries"
#: surveybox/web/templates/form_history_compare.html
msgid "Then"
msgstr "Then"
#: surveybox/web/templates/form_history_compare.html
msgid "Now"
msgstr "Now"
#: surveybox/web/templates/form_history_compare.html
msgid "changed"
msgstr "changed"
#: surveybox/web/templates/form_history_compare.html
msgid "Questions and options"
msgstr "Questions and options"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "With %(num)d answer"
msgid_plural "With %(num)d answers"
msgstr[0] "With %(num)d answer"
msgstr[1] "With %(num)d answers"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "%(num)d booked place"
msgid_plural "%(num)d booked places"
msgstr[0] "%(num)d booked place"
msgstr[1] "%(num)d booked places"
#: surveybox/web/templates/form_history_compare.html
msgid ""
"Text, settings and options as they were then. Options added since are kept; removed options are "
"listed separately."
msgstr ""
"Text, settings and options as they were then. Options added since are kept; removed options are "
"listed separately."
#: surveybox/web/templates/form_history_compare.html
msgid "option removed"
msgstr "option removed"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "Question: %(question)s"
msgstr "Question: %(question)s"
#: surveybox/web/templates/form_history_compare.html
msgid "Answer without name"
msgstr "Answer without name"
#: surveybox/web/templates/form_history_compare.html
msgid "deleted by a manager"
msgstr "deleted by a manager"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "Submitted %(date)s"
msgstr "Submitted %(date)s"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "%(num)d answered question"
msgid_plural "%(num)d answered questions"
msgstr[0] "%(num)d answered question"
msgstr[1] "%(num)d answered questions"
#: surveybox/web/templates/form_history_compare.html
msgid "changed by a manager"
msgstr "changed by a manager"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "Changed %(date)s"
msgstr "Changed %(date)s"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "%(num)d question differs"
msgid_plural "%(num)d questions differ"
msgstr[0] "%(num)d question differs"
msgstr[1] "%(num)d questions differ"
#: surveybox/web/templates/form_history_compare.html
msgid ""
"Before restoring, the current state is saved too, so this step can be undone in the history. "
"Booked places are restored even if there are not enough places any more; the option is then shown"
" as overbooked."
msgstr ""
"Before restoring, the current state is saved too, so this step can be undone in the history. "
"Booked places are restored even if there are not enough places any more; the option is then shown"
" as overbooked."
#: surveybox/web/templates/form_history_compare.html
msgid "Restore selected"
msgstr "Restore selected"
#: surveybox/web/templates/form_preview.html
msgid "Phone"
msgstr "Phone"
@@ -4384,6 +4757,10 @@ msgstr "Entry"
msgid "Signed up"
msgstr "Signed up"
#: surveybox/web/templates/form_responses.html
msgid "overbooked"
msgstr "overbooked"
#: surveybox/web/templates/form_responses.html surveybox/web/templates/results_public.html
#, python-format
msgid "%(num)d waiting"
@@ -4474,22 +4851,6 @@ msgstr ""
msgid "General"
msgstr "General"
#: surveybox/web/templates/form_settings.html surveybox/web/templates/forms_list.html
msgid "Title"
msgstr "Title"
#: surveybox/web/templates/form_settings.html
msgid "Description (optional)"
msgstr "Description (optional)"
#: surveybox/web/templates/form_settings.html
msgid "Opens at (optional)"
msgstr "Opens at (optional)"
#: surveybox/web/templates/form_settings.html
msgid "Closes at (optional)"
msgstr "Closes at (optional)"
#: surveybox/web/templates/form_settings.html surveybox/web/templates/forms_list.html
msgid "no group (instance-wide)"
msgstr "no group (instance-wide)"
@@ -4498,10 +4859,6 @@ msgstr "no group (instance-wide)"
msgid "Group administrators of this group and the groups above manage the form too."
msgstr "Group administrators of this group and the groups above manage the form too."
#: surveybox/web/templates/form_settings.html
msgid "Password for access via link"
msgstr "Password for access via link"
#: surveybox/web/templates/form_settings.html
msgid "A password is set. Leave empty to keep it."
msgstr "A password is set. Leave empty to keep it."
@@ -4518,18 +4875,10 @@ msgstr "For “selected users and groups” you choose them on the next page."
msgid "Participation"
msgstr "Participation"
#: surveybox/web/templates/form_settings.html
msgid "A person may fill in the form several times"
msgstr "A person may fill in the form several times"
#: surveybox/web/templates/form_settings.html
msgid "Anonymous: answers are stored without reference to the person"
msgstr "Anonymous: answers are stored without reference to the person"
#: surveybox/web/templates/form_settings.html
msgid "Participants may change their answer"
msgstr "Participants may change their answer"
#: surveybox/web/templates/form_settings.html
msgid "Yes, until the form closes"
msgstr "Yes, until the form closes"
@@ -4538,10 +4887,6 @@ msgstr "Yes, until the form closes"
msgid "For signed-in participants and for guests with their personal link; not for anonymous forms."
msgstr "For signed-in participants and for guests with their personal link; not for anonymous forms."
#: surveybox/web/templates/form_settings.html
msgid "Remind invited people who have not taken part yet … days before the end (empty: no reminder)"
msgstr "Remind invited people who have not taken part yet … days before the end (empty: no reminder)"
#: surveybox/web/templates/form_settings.html
msgid ""
"Only for access “Selected users and groups” and with an end date. Each person gets the reminder "
@@ -4550,10 +4895,6 @@ msgstr ""
"Only for access “Selected users and groups” and with an end date. Each person gets the reminder "
"once, by email; they can switch reminders off in their account."
#: surveybox/web/templates/form_settings.html
msgid "Participants see the results"
msgstr "Participants see the results"
#: surveybox/web/templates/form_settings.html
msgid "Never"
msgstr "Never"
@@ -4582,14 +4923,6 @@ msgstr ""
msgid "Places, calendar and comments"
msgstr "Places, calendar and comments"
#: surveybox/web/templates/form_settings.html
msgid "Places per person across all participation fields (empty: no limit)"
msgstr "Places per person across all participation fields (empty: no limit)"
#: surveybox/web/templates/form_settings.html
msgid "Show who has signed up"
msgstr "Show who has signed up"
#: surveybox/web/templates/form_settings.html
msgid "Yes, first name and initial of the last name"
msgstr "Yes, first name and initial of the last name"
@@ -4608,10 +4941,6 @@ msgstr ""
"name comes from the question “Participant name”, otherwise from the account; email addresses are "
"never shown. The form tells participants about it. Not for anonymous forms."
#: surveybox/web/templates/form_settings.html
msgid "Confirmed dates as calendar"
msgstr "Confirmed dates as calendar"
#: surveybox/web/templates/form_settings.html
msgid "Off"
msgstr "Off"
@@ -4640,18 +4969,6 @@ msgstr "Moderated: new comments are visible after approval"
msgid "Public: new comments are visible at once"
msgstr "Public: new comments are visible at once"
#: surveybox/web/templates/form_settings.html
msgid "Publish comments without the author’s name (managers still see it)"
msgstr "Publish comments without the author’s name (managers still see it)"
#: surveybox/web/templates/form_settings.html
msgid "Notify managers about new comments by email"
msgstr "Notify managers about new comments by email"
#: surveybox/web/templates/form_settings.html
msgid "Reply-to address for messages about this form (optional)"
msgstr "Reply-to address for messages about this form (optional)"
#: surveybox/web/templates/form_settings.html
msgid ""
"Replies to messages about this form go to this address. Empty: the address from the email "
@@ -4664,22 +4981,6 @@ msgstr ""
msgid "Data protection"
msgstr "Data protection"
#: surveybox/web/templates/form_settings.html
msgid "Privacy notice shown with the form (optional)"
msgstr "Privacy notice shown with the form (optional)"
#: surveybox/web/templates/form_settings.html
msgid "Participants must give their consent"
msgstr "Participants must give their consent"
#: surveybox/web/templates/form_settings.html
msgid "Consent text"
msgstr "Consent text"
#: surveybox/web/templates/form_settings.html
msgid "Retention period in days after the end of the form"
msgstr "Retention period in days after the end of the form"
#: surveybox/web/templates/form_settings.html
#, python-format
msgid ""
@@ -4699,10 +5000,6 @@ msgstr "The answers will be deleted on %(date)s."
msgid "The answers will be anonymized on %(date)s."
msgstr "The answers will be anonymized on %(date)s."
#: surveybox/web/templates/form_settings.html
msgid "When the retention period ends or a participant is deleted"
msgstr "When the retention period ends or a participant is deleted"
#: surveybox/web/templates/form_settings.html
msgid "Keep the answer anonymized"
msgstr "Keep the answer anonymized"
@@ -4711,10 +5008,6 @@ msgstr "Keep the answer anonymized"
msgid "Delete the answer completely"
msgstr "Delete the answer completely"
#: surveybox/web/templates/form_settings.html
msgid "Email address of guests"
msgstr "Email address of guests"
#: surveybox/web/templates/form_settings.html surveybox/web/templates/question_edit.html
msgid "Do not ask"
msgstr "Do not ask"
@@ -4771,6 +5064,21 @@ msgstr "Renew link"
msgid "Delete form"
msgstr "Delete form"
#: surveybox/web/templates/form_settings.html
#, python-format
msgid ""
"The form goes to the trash in the form list. There you can restore it for %(num)d day; after that"
" it is deleted for good."
msgid_plural ""
"The form goes to the trash in the form list. There you can restore it for %(num)d days; after "
"that it is deleted for good."
msgstr[0] ""
"The form goes to the trash in the form list. There you can restore it for %(num)d day; after that"
" it is deleted for good."
msgstr[1] ""
"The form goes to the trash in the form list. There you can restore it for %(num)d days; after "
"that it is deleted for good."
#: surveybox/web/templates/form_settings.html
msgid "Yes, delete this form with all questions and answers."
msgstr "Yes, delete this form with all questions and answers."
@@ -4811,6 +5119,30 @@ msgstr "Co-editor"
msgid "No forms yet."
msgstr "No forms yet."
#: surveybox/web/templates/forms_list.html
msgid "Trash"
msgstr "Trash"
#: surveybox/web/templates/forms_list.html
msgid ""
"Deleted forms can be restored with all questions and answers until the date shown. After that "
"they are deleted for good."
msgstr ""
"Deleted forms can be restored with all questions and answers until the date shown. After that "
"they are deleted for good."
#: surveybox/web/templates/forms_list.html
msgid "Deleted"
msgstr "Deleted"
#: surveybox/web/templates/forms_list.html
msgid "Restorable until"
msgstr "Restorable until"
#: surveybox/web/templates/forms_list.html
msgid "Restore"
msgstr "Restore"
#: surveybox/web/templates/forms_list.html
msgid "Templates"
msgstr "Templates"
+448 -112
View File
@@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Surveybox VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2026-11-25 16:57+0100\n"
"POT-Creation-Date: 2026-11-26 08:43+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: fr\n"
@@ -82,7 +82,7 @@ msgid "Guest"
msgstr "Invité"
#: surveybox/forms/comments.py surveybox/web/templates/admin_audit.html
#: surveybox/web/templates/response_view.html
#: surveybox/web/templates/form_history.html surveybox/web/templates/response_view.html
msgid "Deleted user"
msgstr "Utilisateur supprimé"
@@ -124,15 +124,16 @@ msgstr "Règle invalide (question absente ou pas avant)"
#: surveybox/forms/conditions.py surveybox/forms/evaluation.py surveybox/forms/export.py
#: surveybox/forms/summary.py surveybox/forms/types.py surveybox/web/routes/forms.py
#: surveybox/web/templates/_fill_fields.html surveybox/web/templates/form_responses.html
#: surveybox/web/templates/results_public.html
#: surveybox/web/templates/_fill_fields.html surveybox/web/templates/form_history_compare.html
#: surveybox/web/templates/form_responses.html surveybox/web/templates/results_public.html
msgid "Yes"
msgstr "Oui"
#: surveybox/forms/conditions.py surveybox/forms/evaluation.py surveybox/forms/export.py
#: surveybox/forms/summary.py surveybox/forms/types.py surveybox/web/routes/forms.py
#: surveybox/web/templates/_fill_fields.html surveybox/web/templates/form_responses.html
#: surveybox/web/templates/form_settings.html surveybox/web/templates/results_public.html
#: surveybox/web/templates/_fill_fields.html surveybox/web/templates/form_history_compare.html
#: surveybox/web/templates/form_responses.html surveybox/web/templates/form_settings.html
#: surveybox/web/templates/results_public.html
msgid "No"
msgstr "Non"
@@ -236,7 +237,8 @@ msgid "Page %(page)s of %(pages)s"
msgstr "Page %(page)s sur %(pages)s"
#: surveybox/forms/export.py surveybox/forms/pdf_export.py surveybox/web/templates/form_designer.html
#: surveybox/web/templates/form_responses.html surveybox/web/templates/forms_list.html
#: surveybox/web/templates/form_history_compare.html surveybox/web/templates/form_responses.html
#: surveybox/web/templates/forms_list.html
msgid "Answers"
msgstr "Réponses"
@@ -850,6 +852,18 @@ msgstr "Le formulaire a été enregistré."
msgid "The form has been deleted."
msgstr "Le formulaire a été supprimé."
#: surveybox/web/templating.py
msgid "The form has been moved to the trash. It can be restored there for a limited time."
msgstr "Le formulaire a été placé dans la corbeille. Il peut y être restauré pendant un temps limité."
#: surveybox/web/templating.py
msgid "The form has been restored from the trash."
msgstr "Le formulaire a été restauré depuis la corbeille."
#: surveybox/web/templating.py
msgid "The selected changes have been restored."
msgstr "Les modifications sélectionnées ont été restaurées."
#: surveybox/web/templating.py
msgid "The copy has been created. It is a draft."
msgstr "La copie a été créée. C’est un brouillon."
@@ -1104,6 +1118,18 @@ msgstr "Durée de conservation par défaut modifiée"
msgid "Retention period applied to a form"
msgstr "Durée de conservation appliquée à un formulaire"
#: surveybox/web/routes/admin.py
msgid "Changes restored from the form history"
msgstr "Modifications restaurées depuis l’historique"
#: surveybox/web/routes/admin.py
msgid "Deleted form restored"
msgstr "Formulaire supprimé restauré"
#: surveybox/web/routes/admin.py
msgid "Form history settings changed"
msgstr "Paramètres de l’historique et de la corbeille modifiés"
#: surveybox/web/routes/admin.py
msgid "Account deleted"
msgstr "Compte supprimé"
@@ -1445,6 +1471,147 @@ msgstr "remis au serveur de messagerie"
msgid "sending failed"
msgstr "échec de l’envoi"
#: surveybox/web/routes/form_history.py
msgid "Before a change to questions or settings"
msgstr "Avant une modification des questions ou des paramètres"
#: surveybox/web/routes/form_history.py
msgid "Before an answer was changed by a manager"
msgstr "Avant qu’une réponse soit modifiée par un gestionnaire"
#: surveybox/web/routes/form_history.py
msgid "Before an answer was deleted by a manager"
msgstr "Avant qu’une réponse soit supprimée par un gestionnaire"
#: surveybox/web/routes/form_history.py
msgid "Daily"
msgstr "Quotidien"
#: surveybox/web/routes/form_history.py
msgid "Before a restore"
msgstr "Avant une restauration"
#: surveybox/web/routes/form_history.py
msgid "When the form was deleted"
msgstr "À la suppression du formulaire"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
#: surveybox/web/templates/forms_list.html
msgid "Title"
msgstr "Titre"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Description (optional)"
msgstr "Description (facultatif)"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Opens at (optional)"
msgstr "Ouverture le (facultatif)"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Closes at (optional)"
msgstr "Fermeture le (facultatif)"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_access.html
#: surveybox/web/templates/form_designer.html surveybox/web/templates/form_settings.html
msgid "Who may fill in"
msgstr "Qui peut remplir"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Password for access via link"
msgstr "Mot de passe pour l’accès par lien"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "A person may fill in the form several times"
msgstr "Une personne peut remplir le formulaire plusieurs fois"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Participants may change their answer"
msgstr "Les participants peuvent modifier leur réponse"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Email address of guests"
msgstr "Adresse e-mail des invités"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Participants see the results"
msgstr "Les participants voient les résultats"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Retention period in days after the end of the form"
msgstr "Durée de conservation en jours après la fin du formulaire"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "When the retention period ends or a participant is deleted"
msgstr "Lorsque la durée de conservation expire ou qu’un participant est supprimé"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Privacy notice shown with the form (optional)"
msgstr "Mention de confidentialité affichée avec le formulaire (facultatif)"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Participants must give their consent"
msgstr "Les participants doivent donner leur consentement"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Consent text"
msgstr "Texte de consentement"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Show who has signed up"
msgstr "Afficher les inscrits"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Places per person across all participation fields (empty: no limit)"
msgstr "Places par personne pour tous les champs de participation (vide : sans limite)"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Remind invited people who have not taken part yet … days before the end (empty: no reminder)"
msgstr ""
"Rappeler aux personnes invitées n’ayant pas encore participé … jours avant la fin (vide : aucun "
"rappel)"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Confirmed dates as calendar"
msgstr "Dates confirmées sous forme d’agenda"
#: surveybox/web/routes/form_history.py surveybox/web/templates/_comments.html
#: surveybox/web/templates/form_comments.html surveybox/web/templates/form_designer.html
#: surveybox/web/templates/form_settings.html
msgid "Comments"
msgstr "Commentaires"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Publish comments without the author’s name (managers still see it)"
msgstr "Publier les commentaires sans le nom de l’auteur (les gestionnaires le voient)"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Reply-to address for messages about this form (optional)"
msgstr "Adresse de réponse pour les messages sur ce formulaire (facultatif)"
#: surveybox/web/routes/form_history.py surveybox/web/templates/form_settings.html
msgid "Notify managers about new comments by email"
msgstr "Informer les gestionnaires des nouveaux commentaires par e-mail"
#: surveybox/web/routes/form_history.py surveybox/web/templates/admin_audit.html
#: surveybox/web/templates/form_settings.html surveybox/web/templates/form_team.html
#: surveybox/web/templates/forms_list.html
msgid "Group"
msgstr "Groupe"
#: surveybox/web/routes/form_history.py
msgid "Please choose at least one change to restore."
msgstr "Veuillez choisir au moins une modification à restaurer."
#: surveybox/web/routes/form_history.py surveybox/web/routes/forms.py
msgid "This form can no longer be restored."
msgstr "Ce formulaire ne peut plus être restauré."
#: surveybox/web/routes/form_history.py
#, python-format
msgid "Restored from the form history (state of %(date)s)."
msgstr "Restauré depuis l’historique (état du %(date)s)."
#: surveybox/web/routes/form_results.py
msgid "Please describe why you change this answer."
msgstr "Veuillez indiquer pourquoi vous modifiez cette réponse."
@@ -1740,11 +1907,6 @@ msgstr "Un compte existe déjà pour cette adresse. Veuillez vous connecter."
msgid "Registration is switched off."
msgstr "L’inscription est désactivée."
#: surveybox/web/templates/_comments.html surveybox/web/templates/form_comments.html
#: surveybox/web/templates/form_designer.html surveybox/web/templates/form_settings.html
msgid "Comments"
msgstr "Commentaires"
#: surveybox/web/templates/_comments.html
msgid "edited"
msgstr "modifié"
@@ -2360,7 +2522,8 @@ msgstr "Mise en page"
#: surveybox/web/templates/admin_appearance.html surveybox/web/templates/admin_settings.html
#: surveybox/web/templates/base.html surveybox/web/templates/form_designer.html
#: surveybox/web/templates/form_responses.html surveybox/web/templates/form_settings.html
#: surveybox/web/templates/form_history_compare.html surveybox/web/templates/form_responses.html
#: surveybox/web/templates/form_settings.html
msgid "Settings"
msgstr "Paramètres"
@@ -2631,7 +2794,7 @@ msgstr ""
msgid "Action"
msgstr "Action"
#: surveybox/web/templates/admin_audit.html
#: surveybox/web/templates/admin_audit.html surveybox/web/templates/form_history.html
msgid "By"
msgstr "Par"
@@ -2649,12 +2812,7 @@ msgstr "Compte supprimé n° %(n)s"
msgid "Guest address no. %(n)s"
msgstr "Adresse d’invité n° %(n)s"
#: surveybox/web/templates/admin_audit.html surveybox/web/templates/form_settings.html
#: surveybox/web/templates/form_team.html surveybox/web/templates/forms_list.html
msgid "Group"
msgstr "Groupe"
#: surveybox/web/templates/admin_audit.html
#: surveybox/web/templates/admin_audit.html surveybox/web/templates/form_history_compare.html
msgid "deleted"
msgstr "supprimé"
@@ -3203,6 +3361,47 @@ msgstr ""
"supprimées, selon le réglage du formulaire. Le propriétaire est prévenu 14 jours avant ; si "
"l’avis arrive plus tard, au moins 7 jours s’écoulent avant toute suppression."
#: surveybox/web/templates/admin_settings.html
msgid "Form history and trash"
msgstr "Historique et corbeille"
#: surveybox/web/templates/admin_settings.html
#, python-format
msgid "The history can be kept for %(a)d to %(b)d days, the trash for %(c)d to %(d)d days."
msgstr "L’historique peut être conservé de %(a)d à %(b)d jours, la corbeille de %(c)d à %(d)d jours."
#: surveybox/web/templates/admin_settings.html
msgid "Keep saved states of forms for … days"
msgstr "Conserver les états enregistrés des formulaires pendant … jours"
#: surveybox/web/templates/admin_settings.html
msgid ""
"States are saved before changes to questions, options, settings and access, before managers "
"change or delete answers, and once a day if a form changed. Managers use them to restore "
"individual questions, options, settings or answers. They contain the answers, so they never "
"outlast them: when a form is deleted or its retention period ends, its states are deleted too."
msgstr ""
"Des états sont enregistrés avant les modifications des questions, options, paramètres et accès, "
"avant que des gestionnaires modifient ou suppriment des réponses, et une fois par jour si un "
"formulaire a changé. Ils permettent de restaurer des questions, options, paramètres ou réponses "
"individuels. Ils contiennent les réponses et ne leur survivent donc jamais : si un formulaire est"
" supprimé ou si son délai de conservation expire, ses états sont supprimés aussi."
#: surveybox/web/templates/admin_settings.html
msgid "Keep deleted forms in the trash for … days"
msgstr "Conserver les formulaires supprimés dans la corbeille pendant … jours"
#: surveybox/web/templates/admin_settings.html
msgid ""
"During this time the owner, the person who deleted it, group administrators and administrators "
"can restore a deleted form with all questions and answers. Afterwards it is deleted for good. If "
"a person is deleted, their answers are also removed from the trash and the history at once."
msgstr ""
"Pendant ce temps, le propriétaire, la personne qui l’a supprimé, les administrateurs de groupe et"
" les administrateurs peuvent restaurer un formulaire supprimé avec toutes ses questions et "
"réponses. Ensuite, il est supprimé définitivement. Si une personne est supprimée, ses réponses "
"disparaissent aussitôt aussi de la corbeille et de l’historique."
#: surveybox/web/templates/admin_user_delete.html surveybox/web/templates/admin_user_edit.html
msgid "Delete user"
msgstr "Supprimer l’utilisateur"
@@ -4015,11 +4214,6 @@ msgstr ""
msgid "Access"
msgstr "Accès"
#: surveybox/web/templates/form_access.html surveybox/web/templates/form_designer.html
#: surveybox/web/templates/form_settings.html
msgid "Who may fill in"
msgstr "Qui peut remplir"
#: surveybox/web/templates/form_access.html
msgid ""
"Choose groups and individual users. Members of a chosen group always have access, also if they "
@@ -4040,10 +4234,14 @@ msgstr "Valider"
msgid "All forms"
msgstr "Tous les formulaires"
#: surveybox/web/templates/form_designer.html
#: surveybox/web/templates/form_designer.html surveybox/web/templates/forms_list.html
msgid "Template"
msgstr "Modèle"
#: surveybox/web/templates/form_designer.html surveybox/web/templates/form_history.html
msgid "More places are booked than available:"
msgstr "Plus de places sont réservées que disponibles :"
#: surveybox/web/templates/form_designer.html surveybox/web/templates/form_preview.html
msgid "Live preview"
msgstr "Aperçu en direct"
@@ -4052,6 +4250,11 @@ msgstr "Aperçu en direct"
msgid "Team"
msgstr "Équipe"
#: surveybox/web/templates/form_designer.html surveybox/web/templates/form_history.html
#: surveybox/web/templates/form_history_compare.html
msgid "History"
msgstr "Historique"
#: surveybox/web/templates/form_designer.html
#, python-format
msgid "%(num)d new"
@@ -4273,6 +4476,182 @@ msgstr[1] "%(num)d personnes"
msgid "No follow-up emails yet."
msgstr "Aucun e-mail de suivi pour l’instant."
#: surveybox/web/templates/form_history.html
msgid "Nobody was moved to the waiting list. Raise the number of places or contact the people concerned."
msgstr ""
"Personne n’a été placé sur la liste d’attente. Augmentez le nombre de places ou contactez les "
"personnes concernées."
#: surveybox/web/templates/form_history.html
msgid ""
"Surveybox saves the state of this form before questions, options, settings or access are changed,"
" before a manager changes or deletes an answer, and once a day if anything changed. Choose a "
"state to see what differs from now and to restore individual questions, options, settings or "
"answers. Everything else stays as it is."
msgstr ""
"Surveybox enregistre l’état de ce formulaire avant toute modification des questions, options, "
"paramètres ou accès, avant qu’un gestionnaire modifie ou supprime une réponse, et une fois par "
"jour en cas de changement. Choisissez un état pour voir ce qui diffère d’aujourd’hui et restaurer"
" des questions, options, paramètres ou réponses individuels. Tout le reste reste inchangé."
#: surveybox/web/templates/form_history.html
#, python-format
msgid "States are kept for %(num)d day, at most as long as the answers themselves."
msgid_plural "States are kept for %(num)d days, at most as long as the answers themselves."
msgstr[0] "Les états sont conservés %(num)d jour, au plus aussi longtemps que les réponses elles-mêmes."
msgstr[1] "Les états sont conservés %(num)d jours, au plus aussi longtemps que les réponses elles-mêmes."
#: surveybox/web/templates/form_history.html
msgid ""
"Changes and deletions by participants themselves are not restored; what participants delete also "
"disappears from the history."
msgstr ""
"Les modifications et suppressions faites par les participants eux-mêmes ne sont pas restaurées ; "
"ce que les participants suppriment disparaît aussi de l’historique."
#: surveybox/web/templates/form_history.html
msgid "Saved"
msgstr "Enregistré"
#: surveybox/web/templates/form_history.html
msgid "Occasion"
msgstr "Occasion"
#: surveybox/web/templates/form_history.html
msgid "Compare"
msgstr "Comparer"
#: surveybox/web/templates/form_history.html
msgid "No states yet. The first one is saved with the next change."
msgstr "Aucun état pour l’instant. Le premier sera enregistré à la prochaine modification."
#: surveybox/web/templates/form_history_compare.html
msgid "empty"
msgstr "vide"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "State of %(date)s"
msgstr "État du %(date)s"
#: surveybox/web/templates/form_history_compare.html
msgid "Nothing in this state differs from the form as it is now in a way that can be restored."
msgstr "Rien dans cet état ne diffère du formulaire actuel d’une manière qui puisse être restaurée."
#: surveybox/web/templates/form_history_compare.html
msgid ""
"Choose what to restore. Only the chosen items change; questions, answers and settings that are "
"not chosen stay as they are now."
msgstr ""
"Choisissez ce qu’il faut restaurer. Seuls les éléments choisis changent ; les questions, réponses"
" et paramètres non choisis restent tels quels."
#: surveybox/web/templates/form_history_compare.html
msgid "Access for people and groups"
msgstr "Accès pour des personnes et des groupes"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "Then: %(old)d entries, now: %(new)d entries"
msgstr "Alors : %(old)d entrées, maintenant : %(new)d entrées"
#: surveybox/web/templates/form_history_compare.html
msgid "Then"
msgstr "Alors"
#: surveybox/web/templates/form_history_compare.html
msgid "Now"
msgstr "Maintenant"
#: surveybox/web/templates/form_history_compare.html
msgid "changed"
msgstr "modifié"
#: surveybox/web/templates/form_history_compare.html
msgid "Questions and options"
msgstr "Questions et options"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "With %(num)d answer"
msgid_plural "With %(num)d answers"
msgstr[0] "Avec %(num)d réponse"
msgstr[1] "Avec %(num)d réponses"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "%(num)d booked place"
msgid_plural "%(num)d booked places"
msgstr[0] "%(num)d place réservée"
msgstr[1] "%(num)d places réservées"
#: surveybox/web/templates/form_history_compare.html
msgid ""
"Text, settings and options as they were then. Options added since are kept; removed options are "
"listed separately."
msgstr ""
"Texte, paramètres et options tels qu’ils étaient alors. Les options ajoutées depuis sont "
"conservées ; les options supprimées sont listées séparément."
#: surveybox/web/templates/form_history_compare.html
msgid "option removed"
msgstr "option supprimée"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "Question: %(question)s"
msgstr "Question : %(question)s"
#: surveybox/web/templates/form_history_compare.html
msgid "Answer without name"
msgstr "Réponse sans nom"
#: surveybox/web/templates/form_history_compare.html
msgid "deleted by a manager"
msgstr "supprimée par un gestionnaire"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "Submitted %(date)s"
msgstr "Envoyée le %(date)s"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "%(num)d answered question"
msgid_plural "%(num)d answered questions"
msgstr[0] "%(num)d question répondue"
msgstr[1] "%(num)d questions répondues"
#: surveybox/web/templates/form_history_compare.html
msgid "changed by a manager"
msgstr "modifiée par un gestionnaire"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "Changed %(date)s"
msgstr "Modifiée le %(date)s"
#: surveybox/web/templates/form_history_compare.html
#, python-format
msgid "%(num)d question differs"
msgid_plural "%(num)d questions differ"
msgstr[0] "%(num)d question diffère"
msgstr[1] "%(num)d questions diffèrent"
#: surveybox/web/templates/form_history_compare.html
msgid ""
"Before restoring, the current state is saved too, so this step can be undone in the history. "
"Booked places are restored even if there are not enough places any more; the option is then shown"
" as overbooked."
msgstr ""
"Avant la restauration, l’état actuel est aussi enregistré : cette étape peut donc être annulée "
"dans l’historique. Les places réservées sont restaurées même s’il n’y a plus assez de places ; "
"l’option est alors signalée comme surréservée."
#: surveybox/web/templates/form_history_compare.html
msgid "Restore selected"
msgstr "Restaurer la sélection"
#: surveybox/web/templates/form_preview.html
msgid "Phone"
msgstr "Téléphone"
@@ -4431,6 +4810,10 @@ msgstr "Entrée"
msgid "Signed up"
msgstr "Inscrits"
#: surveybox/web/templates/form_responses.html
msgid "overbooked"
msgstr "surréservé"
#: surveybox/web/templates/form_responses.html surveybox/web/templates/results_public.html
#, python-format
msgid "%(num)d waiting"
@@ -4522,22 +4905,6 @@ msgstr ""
msgid "General"
msgstr "Général"
#: surveybox/web/templates/form_settings.html surveybox/web/templates/forms_list.html
msgid "Title"
msgstr "Titre"
#: surveybox/web/templates/form_settings.html
msgid "Description (optional)"
msgstr "Description (facultatif)"
#: surveybox/web/templates/form_settings.html
msgid "Opens at (optional)"
msgstr "Ouverture le (facultatif)"
#: surveybox/web/templates/form_settings.html
msgid "Closes at (optional)"
msgstr "Fermeture le (facultatif)"
#: surveybox/web/templates/form_settings.html surveybox/web/templates/forms_list.html
msgid "no group (instance-wide)"
msgstr "aucun groupe (toute l’instance)"
@@ -4546,10 +4913,6 @@ msgstr "aucun groupe (toute l’instance)"
msgid "Group administrators of this group and the groups above manage the form too."
msgstr "Les administrateurs de ce groupe et des groupes supérieurs gèrent aussi le formulaire."
#: surveybox/web/templates/form_settings.html
msgid "Password for access via link"
msgstr "Mot de passe pour l’accès par lien"
#: surveybox/web/templates/form_settings.html
msgid "A password is set. Leave empty to keep it."
msgstr "Un mot de passe est défini. Laissez vide pour le conserver."
@@ -4566,18 +4929,10 @@ msgstr "Pour « utilisateurs et groupes sélectionnés », vous les choisissez
msgid "Participation"
msgstr "Participation"
#: surveybox/web/templates/form_settings.html
msgid "A person may fill in the form several times"
msgstr "Une personne peut remplir le formulaire plusieurs fois"
#: surveybox/web/templates/form_settings.html
msgid "Anonymous: answers are stored without reference to the person"
msgstr "Anonyme : les réponses sont enregistrées sans lien avec la personne"
#: surveybox/web/templates/form_settings.html
msgid "Participants may change their answer"
msgstr "Les participants peuvent modifier leur réponse"
#: surveybox/web/templates/form_settings.html
msgid "Yes, until the form closes"
msgstr "Oui, jusqu’à la fermeture du formulaire"
@@ -4588,12 +4943,6 @@ msgstr ""
"Pour les participants connectés et les invités avec leur lien personnel ; pas pour les "
"formulaires anonymes."
#: surveybox/web/templates/form_settings.html
msgid "Remind invited people who have not taken part yet … days before the end (empty: no reminder)"
msgstr ""
"Rappeler aux personnes invitées n’ayant pas encore participé … jours avant la fin (vide : aucun "
"rappel)"
#: surveybox/web/templates/form_settings.html
msgid ""
"Only for access “Selected users and groups” and with an end date. Each person gets the reminder "
@@ -4602,10 +4951,6 @@ msgstr ""
"Uniquement pour l’accès « Utilisateurs et groupes sélectionnés » et avec une date de fin. Chaque "
"personne reçoit le rappel une fois par e-mail ; elle peut le désactiver dans son compte."
#: surveybox/web/templates/form_settings.html
msgid "Participants see the results"
msgstr "Les participants voient les résultats"
#: surveybox/web/templates/form_settings.html
msgid "Never"
msgstr "Jamais"
@@ -4636,14 +4981,6 @@ msgstr ""
msgid "Places, calendar and comments"
msgstr "Places, agenda et commentaires"
#: surveybox/web/templates/form_settings.html
msgid "Places per person across all participation fields (empty: no limit)"
msgstr "Places par personne pour tous les champs de participation (vide : sans limite)"
#: surveybox/web/templates/form_settings.html
msgid "Show who has signed up"
msgstr "Afficher les inscrits"
#: surveybox/web/templates/form_settings.html
msgid "Yes, first name and initial of the last name"
msgstr "Oui, prénom et initiale du nom"
@@ -4663,10 +5000,6 @@ msgstr ""
"adresses e-mail ne sont jamais affichées. Le formulaire en informe les participants. Pas pour les"
" formulaires anonymes."
#: surveybox/web/templates/form_settings.html
msgid "Confirmed dates as calendar"
msgstr "Dates confirmées sous forme d’agenda"
#: surveybox/web/templates/form_settings.html
msgid "Off"
msgstr "Désactivé"
@@ -4695,18 +5028,6 @@ msgstr "Modéré : les nouveaux commentaires sont visibles après validation"
msgid "Public: new comments are visible at once"
msgstr "Public : les nouveaux commentaires sont visibles immédiatement"
#: surveybox/web/templates/form_settings.html
msgid "Publish comments without the author’s name (managers still see it)"
msgstr "Publier les commentaires sans le nom de l’auteur (les gestionnaires le voient)"
#: surveybox/web/templates/form_settings.html
msgid "Notify managers about new comments by email"
msgstr "Informer les gestionnaires des nouveaux commentaires par e-mail"
#: surveybox/web/templates/form_settings.html
msgid "Reply-to address for messages about this form (optional)"
msgstr "Adresse de réponse pour les messages sur ce formulaire (facultatif)"
#: surveybox/web/templates/form_settings.html
msgid ""
"Replies to messages about this form go to this address. Empty: the address from the email "
@@ -4719,22 +5040,6 @@ msgstr ""
msgid "Data protection"
msgstr "Protection des données"
#: surveybox/web/templates/form_settings.html
msgid "Privacy notice shown with the form (optional)"
msgstr "Mention de confidentialité affichée avec le formulaire (facultatif)"
#: surveybox/web/templates/form_settings.html
msgid "Participants must give their consent"
msgstr "Les participants doivent donner leur consentement"
#: surveybox/web/templates/form_settings.html
msgid "Consent text"
msgstr "Texte de consentement"
#: surveybox/web/templates/form_settings.html
msgid "Retention period in days after the end of the form"
msgstr "Durée de conservation en jours après la fin du formulaire"
#: surveybox/web/templates/form_settings.html
#, python-format
msgid ""
@@ -4754,10 +5059,6 @@ msgstr "Les réponses seront supprimées le %(date)s."
msgid "The answers will be anonymized on %(date)s."
msgstr "Les réponses seront anonymisées le %(date)s."
#: surveybox/web/templates/form_settings.html
msgid "When the retention period ends or a participant is deleted"
msgstr "Lorsque la durée de conservation expire ou qu’un participant est supprimé"
#: surveybox/web/templates/form_settings.html
msgid "Keep the answer anonymized"
msgstr "Conserver la réponse anonymisée"
@@ -4766,10 +5067,6 @@ msgstr "Conserver la réponse anonymisée"
msgid "Delete the answer completely"
msgstr "Supprimer complètement la réponse"
#: surveybox/web/templates/form_settings.html
msgid "Email address of guests"
msgstr "Adresse e-mail des invités"
#: surveybox/web/templates/form_settings.html surveybox/web/templates/question_edit.html
msgid "Do not ask"
msgstr "Ne pas demander"
@@ -4829,6 +5126,21 @@ msgstr "Renouveler le lien"
msgid "Delete form"
msgstr "Supprimer le formulaire"
#: surveybox/web/templates/form_settings.html
#, python-format
msgid ""
"The form goes to the trash in the form list. There you can restore it for %(num)d day; after that"
" it is deleted for good."
msgid_plural ""
"The form goes to the trash in the form list. There you can restore it for %(num)d days; after "
"that it is deleted for good."
msgstr[0] ""
"Le formulaire va dans la corbeille de la liste des formulaires. Vous pouvez l’y restaurer pendant"
" %(num)d jour ; ensuite, il est supprimé définitivement."
msgstr[1] ""
"Le formulaire va dans la corbeille de la liste des formulaires. Vous pouvez l’y restaurer pendant"
" %(num)d jours ; ensuite, il est supprimé définitivement."
#: surveybox/web/templates/form_settings.html
msgid "Yes, delete this form with all questions and answers."
msgstr "Oui, supprimer ce formulaire avec toutes les questions et réponses."
@@ -4869,6 +5181,30 @@ msgstr "Coéditeur"
msgid "No forms yet."
msgstr "Pas encore de formulaires."
#: surveybox/web/templates/forms_list.html
msgid "Trash"
msgstr "Corbeille"
#: surveybox/web/templates/forms_list.html
msgid ""
"Deleted forms can be restored with all questions and answers until the date shown. After that "
"they are deleted for good."
msgstr ""
"Les formulaires supprimés peuvent être restaurés avec toutes leurs questions et réponses jusqu’à "
"la date indiquée. Ensuite, ils sont supprimés définitivement."
#: surveybox/web/templates/forms_list.html
msgid "Deleted"
msgstr "Supprimé"
#: surveybox/web/templates/forms_list.html
msgid "Restorable until"
msgstr "Restaurable jusqu’au"
#: surveybox/web/templates/forms_list.html
msgid "Restore"
msgstr "Restaurer"
#: surveybox/web/templates/forms_list.html
msgid "Templates"
msgstr "Modèles"
File diff suppressed because it is too large. Load diff
+5
View File
@@ -182,8 +182,13 @@ def by_ids(db: Session, form: Form, ids: list[str]) -> dict[str, MediaFile]:
def referenced_keys(db: Session) -> set[str]:
"""Dateien, die noch gebraucht werden: aus der Datenbank und aus dem Verlauf
der Formulare (dort bleiben sie wiederherstellbar)."""
from surveybox.forms import history
keys = set(db.scalars(select(MediaFile.storage_key)))
keys.update(k for k in db.scalars(select(MediaFile.thumb_key)) if k)
keys.update(history.referenced_media_keys(db))
return keys
@@ -0,0 +1,83 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
"""Verlauf von Formularen (Stände zum punktuellen Wiederherstellen) und Papierkorb.
Revision: 0018_form_history
Vorgänger: 0017_response_note
"""
from collections.abc import Sequence
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
revision: str = "0018_form_history"
down_revision: str | None = "0017_response_note"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None
EMPTY = sa.text("'[]'::jsonb")
def upgrade() -> None:
op.create_table(
"form_snapshot",
sa.Column("id", sa.BigInteger(), autoincrement=True, nullable=False),
sa.Column("form_id", sa.BigInteger(), nullable=False),
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.text("now()"),
nullable=False),
sa.Column("reason", sa.Text(), nullable=False),
sa.Column("actor_id", sa.BigInteger(), nullable=True),
sa.Column("full_hash", postgresql.BYTEA(), nullable=False),
sa.Column("data_hash", postgresql.BYTEA(), nullable=False),
sa.Column("size", sa.Integer(), nullable=False),
sa.Column("payload", postgresql.BYTEA(), nullable=False),
sa.Column("media_keys", postgresql.JSONB(astext_type=sa.Text()), server_default=EMPTY,
nullable=False),
sa.Column("user_ids", postgresql.JSONB(astext_type=sa.Text()), server_default=EMPTY,
nullable=False),
sa.Column("guest_ids", postgresql.JSONB(astext_type=sa.Text()), server_default=EMPTY,
nullable=False),
sa.ForeignKeyConstraint(["actor_id"], ["user_account.id"],
name=op.f("fk_form_snapshot_actor_id_user_account"),
ondelete="SET NULL"),
sa.PrimaryKeyConstraint("id", name=op.f("pk_form_snapshot")),
)
op.create_index(op.f("ix_form_snapshot_form_id"), "form_snapshot", ["form_id"])
op.create_index(op.f("ix_form_snapshot_actor_id"), "form_snapshot", ["actor_id"])
op.create_table(
"form_trash",
sa.Column("form_id", sa.BigInteger(), nullable=False),
sa.Column("public_id", postgresql.UUID(as_uuid=True), nullable=False),
sa.Column("title", sa.Text(), nullable=False),
sa.Column("owner_id", sa.BigInteger(), nullable=True),
sa.Column("deleted_by", sa.BigInteger(), nullable=True),
sa.Column("deleted_at", sa.DateTime(timezone=True), server_default=sa.text("now()"),
nullable=False),
sa.Column("snapshot_id", sa.BigInteger(), nullable=False),
sa.Column("responses", sa.Integer(), server_default=sa.text("0"), nullable=False),
sa.Column("extra", postgresql.JSONB(astext_type=sa.Text()),
server_default=sa.text("'{}'::jsonb"), nullable=False),
sa.ForeignKeyConstraint(["owner_id"], ["user_account.id"],
name=op.f("fk_form_trash_owner_id_user_account"),
ondelete="SET NULL"),
sa.ForeignKeyConstraint(["deleted_by"], ["user_account.id"],
name=op.f("fk_form_trash_deleted_by_user_account"),
ondelete="SET NULL"),
sa.ForeignKeyConstraint(["snapshot_id"], ["form_snapshot.id"],
name=op.f("fk_form_trash_snapshot_id_form_snapshot"),
ondelete="CASCADE"),
sa.PrimaryKeyConstraint("form_id", name=op.f("pk_form_trash")),
sa.UniqueConstraint("public_id", name=op.f("uq_form_trash_public_id")),
)
op.create_index(op.f("ix_form_trash_owner_id"), "form_trash", ["owner_id"])
op.add_column("response", sa.Column("edited_by", sa.Text(), nullable=True))
def downgrade() -> None:
op.drop_column("response", "edited_by")
op.drop_index(op.f("ix_form_trash_owner_id"), table_name="form_trash")
op.drop_table("form_trash")
op.drop_index(op.f("ix_form_snapshot_actor_id"), table_name="form_snapshot")
op.drop_index(op.f("ix_form_snapshot_form_id"), table_name="form_snapshot")
op.drop_table("form_snapshot")
+3
View File
@@ -45,6 +45,7 @@ from surveybox.models.forms import (
Response,
ResponseNote,
)
from surveybox.models.history import FormSnapshot, FormTrash
from surveybox.models.mail import FormMute, GuestContact, MailMessage, MailStatus
from surveybox.models.system import AppSetting, JobState
@@ -70,7 +71,9 @@ __all__ = [
"FormMember",
"FormMute",
"FormParticipation",
"FormSnapshot",
"FormStatus",
"FormTrash",
"GroupMember",
"GroupRole",
"GroupRoleKind",
+3
View File
@@ -238,6 +238,9 @@ class Response(Base):
access_hash: Mapped[bytes | None] = mapped_column(BYTEA, unique=True)
# Nach Ablauf der Löschfrist oder Löschung der Person: ohne Bezug zur Person
anonymized_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True))
# Wer zuletzt geändert hat: participant oder manager (Verlauf: nur Änderungen
# von Verwaltern lassen sich zurücknehmen)
edited_by: Mapped[str | None] = mapped_column(Text)
answers: Mapped[list[Answer]] = relationship(
back_populates="response", cascade="all, delete-orphan", passive_deletes=True
+78
View File
@@ -0,0 +1,78 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
"""Verlauf von Formularen und Papierkorb.
Ein Stand (`form_snapshot`) hält ein Formular mit allem, was dazugehört:
Einstellungen, Fragen, Antworten, Buchungen, Vermerke, Medienverweise. Er
verweist absichtlich NICHT per Fremdschlüssel auf `form`: Ein gelöschtes
Formular lebt im Papierkorb aus seinen Ständen weiter, bis die Frist abläuft.
Aufräumen übernimmt der Worker (forms.history.prune).
"""
from __future__ import annotations
import uuid
from datetime import datetime
from typing import Any
from sqlalchemy import BigInteger, DateTime, ForeignKey, Integer, Text, func, text
from sqlalchemy.dialects.postgresql import BYTEA, JSONB, UUID
from sqlalchemy.orm import Mapped, mapped_column
from surveybox.models.base import Base
class FormSnapshot(Base):
__tablename__ = "form_snapshot"
id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True)
form_id: Mapped[int] = mapped_column(BigInteger, nullable=False, index=True)
created_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True), nullable=False, server_default=func.now()
)
# Anlass: edit, answer_edit, answer_delete, daily, before_restore, deleted
reason: Mapped[str] = mapped_column(Text, nullable=False)
actor_id: Mapped[int | None] = mapped_column(
BigInteger, ForeignKey("user_account.id", ondelete="SET NULL"), index=True
)
# Prüfsummen: alles / nur Antworten (Entprellen beim Bearbeiten)
full_hash: Mapped[bytes] = mapped_column(BYTEA, nullable=False)
data_hash: Mapped[bytes] = mapped_column(BYTEA, nullable=False)
size: Mapped[int] = mapped_column(Integer, nullable=False)
# zlib-komprimiertes JSON (forms.history.serialize)
payload: Mapped[bytes] = mapped_column(BYTEA, nullable=False)
# Für das Aufräumen der Dateien und das Löschen von Personen ohne Auspacken
media_keys: Mapped[list[str]] = mapped_column(
JSONB, nullable=False, server_default=text("'[]'::jsonb")
)
user_ids: Mapped[list[int]] = mapped_column(
JSONB, nullable=False, server_default=text("'[]'::jsonb")
)
guest_ids: Mapped[list[int]] = mapped_column(
JSONB, nullable=False, server_default=text("'[]'::jsonb")
)
class FormTrash(Base):
"""Gelöschtes Formular, das sich bis `expires_at` wiederherstellen lässt."""
__tablename__ = "form_trash"
form_id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=False)
public_id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), nullable=False, unique=True)
title: Mapped[str] = mapped_column(Text, nullable=False)
owner_id: Mapped[int | None] = mapped_column(
BigInteger, ForeignKey("user_account.id", ondelete="SET NULL"), index=True
)
deleted_by: Mapped[int | None] = mapped_column(
BigInteger, ForeignKey("user_account.id", ondelete="SET NULL")
)
deleted_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True), nullable=False, server_default=func.now()
)
snapshot_id: Mapped[int] = mapped_column(
BigInteger, ForeignKey("form_snapshot.id", ondelete="CASCADE"), nullable=False
)
responses: Mapped[int] = mapped_column(Integer, nullable=False, server_default=text("0"))
extra: Mapped[dict[str, Any]] = mapped_column(
JSONB, nullable=False, server_default=text("'{}'::jsonb")
)
+2
View File
@@ -33,6 +33,7 @@ from surveybox.web.routes import (
fill,
form_comments,
form_followups,
form_history,
form_media,
form_results,
form_team,
@@ -156,6 +157,7 @@ def create_app() -> FastAPI:
app.include_router(admin_mail_templates.router, dependencies=protected)
app.include_router(admin_mail.router, dependencies=protected)
app.include_router(groups.router, dependencies=protected)
app.include_router(form_history.router, dependencies=protected)
app.include_router(forms.router, dependencies=protected)
app.include_router(form_results.router, dependencies=protected)
app.include_router(form_team.router, dependencies=protected)
+11 -1
View File
@@ -8,7 +8,7 @@ from typing import Annotated
from fastapi import Depends, Request
from surveybox.forms import service
from surveybox.forms import history, service
from surveybox.forms.team import Level, level
from surveybox.models import Form
from surveybox.web.deps import CurrentUser, Db, Forbidden, NotFound
@@ -31,3 +31,13 @@ def _form_at(needed: Level) -> Callable[..., Form]:
EvalForm = Annotated[Form, Depends(_form_at(Level.EVALUATE))]
EditForm = Annotated[Form, Depends(_form_at(Level.EDIT))]
OwnForm = Annotated[Form, Depends(_form_at(Level.OWN))]
def _changed_form(db: Db, auth: CurrentUser, form: EditForm) -> Form:
"""Wie EditForm; vorher entsteht ein Stand im Verlauf (siehe forms.history)."""
history.before_change(db, form, auth.user)
return form
# Für Routen, die Fragen, Optionen, Einstellungen oder Freigaben ändern
ChangedForm = Annotated[Form, Depends(_changed_form)]
+3
View File
@@ -91,6 +91,9 @@ ACTION_NAMES: dict[str, str] = {
"admin.registration_changed": N_("Self-registration changed"),
"admin.privacy_changed": N_("Default retention period changed"),
"form.retention_applied": N_("Retention period applied to a form"),
"form.history_restored": N_("Changes restored from the form history"),
"form.trash_restored": N_("Deleted form restored"),
"admin.history_changed": N_("Form history settings changed"),
"account.deleted": N_("Account deleted"),
"account.exported": N_("Own data downloaded"),
"admin.user_exported": N_("Data of a user exported"),
+26 -1
View File
@@ -10,7 +10,7 @@ from fastapi.responses import RedirectResponse, Response
from surveybox import branding
from surveybox.accounts import audit, registration
from surveybox.forms import retention
from surveybox.forms import history, retention
from surveybox.i18n import N_
from surveybox.media import config as media_config
from surveybox.media import images
@@ -43,6 +43,11 @@ def settings_page(request: Request, db: Db, settings: AppSettings, _auth: AdminU
"registration_levels": REGISTRATION_LEVELS,
"retention_days": retention.default_days(db),
"retention_error": request.query_params.get("error") == "retention",
"history_days": history.history_days(db),
"trash_days": history.trash_days(db),
"history_range": history.HISTORY_DAYS_RANGE,
"trash_range": history.TRASH_DAYS_RANGE,
"history_error": request.query_params.get("error") == "history",
},
)
@@ -113,6 +118,22 @@ def save_privacy(db: Db, auth: AdminUser, fields: FormFields) -> Response:
return RedirectResponse("/admin/settings?notice=settings_saved#privacy", status_code=303)
@router.post("/settings/history")
def save_history(db: Db, auth: AdminUser, fields: FormFields) -> Response:
"""Aufbewahrung des Verlaufs der Formulare und des Papierkorbs."""
try:
days = int(_first(fields, "history_days").strip())
trash = int(_first(fields, "trash_days").strip())
history.set_days(db, days, trash)
except ValueError:
return RedirectResponse("/admin/settings?error=history#history", status_code=303)
audit.record(db, "admin.history_changed", actor_id=auth.user.id,
target_type="settings", target_id="history",
details={"history_days": days, "trash_days": trash})
db.commit()
return RedirectResponse("/admin/settings?notice=settings_saved#history", status_code=303)
REGISTRATION_LEVELS = {
"off": N_("Off: only administrators create accounts"),
"guests": N_("Guests: people who confirmed their address when taking part via a form link"),
@@ -179,6 +200,10 @@ def save_settings(
"registration": registration.level(db),
"registration_levels": REGISTRATION_LEVELS,
"retention_days": retention.default_days(db),
"history_days": history.history_days(db),
"trash_days": history.trash_days(db),
"history_range": history.HISTORY_DAYS_RANGE,
"trash_range": history.TRASH_DAYS_RANGE,
},
status_code=400,
)
+199
View File
@@ -0,0 +1,199 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
"""Verlauf eines Formulars (Stände, Vergleich, punktuelle Wiederherstellung) und
Papierkorb gelöschter Formulare. Siehe forms.history."""
from __future__ import annotations
from datetime import UTC, datetime
from typing import Any
from fastapi import APIRouter, Request
from fastapi.responses import RedirectResponse, Response
from sqlalchemy import select
from surveybox.accounts import audit
from surveybox.forms import history
from surveybox.i18n import N_, gettext
from surveybox.models import Form as FormModel
from surveybox.models import FormSnapshot, FormTrash, UserAccount
from surveybox.web.deps import AppSettings, CurrentUser, Db, FormFields, NotFound, UserScope
from surveybox.web.form_deps import EditForm
from surveybox.web.templating import render
router = APIRouter(prefix="/forms", include_in_schema=False)
REASON_NAMES = {
"edit": N_("Before a change to questions or settings"),
"answer_edit": N_("Before an answer was changed by a manager"),
"answer_delete": N_("Before an answer was deleted by a manager"),
"daily": N_("Daily"),
"before_restore": N_("Before a restore"),
"deleted": N_("When the form was deleted"),
}
# Bezeichnungen wie auf der Seite Einstellungen
SETTING_NAMES = {
"title": N_("Title"),
"description": N_("Description (optional)"),
"opens_at": N_("Opens at (optional)"),
"closes_at": N_("Closes at (optional)"),
"access": N_("Who may fill in"),
"link_password_hash": N_("Password for access via link"),
"allow_multiple": N_("A person may fill in the form several times"),
"allow_edit": N_("Participants may change their answer"),
"guest_email": N_("Email address of guests"),
"results_visibility": N_("Participants see the results"),
"retention_days": N_("Retention period in days after the end of the form"),
"deletion_mode": N_("When the retention period ends or a participant is deleted"),
"privacy_notice": N_("Privacy notice shown with the form (optional)"),
"require_consent": N_("Participants must give their consent"),
"consent_text": N_("Consent text"),
"slot_names": N_("Show who has signed up"),
"slots_max_per_person": N_(
"Places per person across all participation fields (empty: no limit)"),
"reminder_days": N_(
"Remind invited people who have not taken part yet … days before the end "
"(empty: no reminder)"
),
"calendar_mode": N_("Confirmed dates as calendar"),
"comments_mode": N_("Comments"),
"comments_anonymous": N_(
"Publish comments without the author’s name (managers still see it)"), # noqa: RUF001
"reply_to": N_("Reply-to address for messages about this form (optional)"),
"comments_notify": N_("Notify managers about new comments by email"),
"group_id": N_("Group"),
}
# Werte, die als Text gezeigt werden; bei den übrigen nur „geändert“
SHOWN_VALUES = {"title", "description", "opens_at", "closes_at", "allow_multiple",
"retention_days", "privacy_notice", "require_consent", "consent_text",
"slots_max_per_person", "reminder_days", "comments_anonymous", "reply_to",
"comments_notify"}
ERRORS = {
"nothing_selected": N_("Please choose at least one change to restore."),
"trash_gone": N_("This form can no longer be restored."),
}
def _names(db: Db, ids: set[int]) -> dict[int, str]:
if not ids:
return {}
return {u.id: u.display_name for u in db.scalars(
select(UserAccount).where(UserAccount.id.in_(ids)))}
def _value(name: str, value: Any) -> Any:
"""Für die Anzeige: Text, Zahl, Datum, ja/nein; None = nicht anzeigen."""
if name not in SHOWN_VALUES:
return None
if isinstance(value, str) and len(value) > 200:
return value[:200] + "…"
return value
# --------------------------------------------------------------------------
# Verlauf eines Formulars
# --------------------------------------------------------------------------
@router.get("/{public_id}/history")
def history_page(request: Request, db: Db, form: EditForm) -> Response:
found = history.snapshots(db, form.id)
return render(request, "form_history.html", {
"form": form,
"snapshots": found,
"actors": _names(db, {s.actor_id for s in found if s.actor_id}),
"reason_names": REASON_NAMES,
"history_days": history.history_days(db),
"overbooked": history.overbooked(db, form),
})
def _snapshot(db: Db, form: FormModel, snapshot_id: int) -> FormSnapshot:
snapshot = history.find_snapshot(db, form.id, snapshot_id)
if snapshot is None:
raise NotFound()
return snapshot
def _compare_page(request: Request, db: Db, form: FormModel, snapshot: FormSnapshot,
**extra: Any) -> Response:
status_code = int(extra.pop("status_code", 200))
comparison = history.compare(db, form, snapshot)
for item in comparison.settings:
if item.kind == "setting":
item.title = SETTING_NAMES.get(item.setting, item.setting)
item.old = _value(item.setting, item.old)
item.new = _value(item.setting, item.new)
return render(request, "form_history_compare.html", {
"form": form,
"snapshot": snapshot,
"comparison": comparison,
"actor": _names(db, {snapshot.actor_id} if snapshot.actor_id else set()).get(
snapshot.actor_id or 0),
"reason_names": REASON_NAMES,
"selected": set(extra.pop("selected", [])),
**extra,
}, status_code=status_code)
@router.get("/{public_id}/history/{snapshot_id}")
def compare_page(request: Request, db: Db, form: EditForm, snapshot_id: int) -> Response:
return _compare_page(request, db, form, _snapshot(db, form, snapshot_id))
@router.post("/{public_id}/history/{snapshot_id}/restore")
def restore(
request: Request, db: Db, settings: AppSettings, auth: CurrentUser, form: EditForm,
snapshot_id: int, fields: FormFields,
) -> Response:
snapshot = _snapshot(db, form, snapshot_id)
keys = [k for k in fields.get("item") or [] if len(k) <= 100][:500]
when = snapshot.created_at.astimezone(settings.tz)
note = gettext("Restored from the form history (state of %(date)s).") % {
"date": when.strftime("%Y-%m-%d %H:%M")}
try:
outcome = history.restore(db, form, snapshot, keys, auth.user, note)
except history.HistoryError as exc:
db.rollback()
return _compare_page(request, db, form, snapshot, error=ERRORS.get(exc.code, exc.code),
selected=keys, status_code=400)
audit.record(db, "form.history_restored", actor_id=auth.user.id, target_type="form",
target_id=form.id, details={"snapshot": snapshot.id,
"items": outcome.restored,
"overbooked": len(outcome.overbooked)})
db.commit()
return RedirectResponse(f"/forms/{form.public_id}/history?notice=history_restored",
status_code=303)
# --------------------------------------------------------------------------
# Papierkorb
# --------------------------------------------------------------------------
def trash_entries(db: Db, user: UserAccount, managed: frozenset[int]) -> list[dict[str, Any]]:
"""Für die Formularliste: gelöschte Formulare, die die Person zurückholen darf."""
now = datetime.now(UTC)
entries = []
for entry in history.visible_trash(db, user, managed):
expires = history.expires_at(db, entry)
entries.append({"entry": entry, "expires": expires,
"days": max((expires - now).days, 0)})
return entries
@router.post("/trash/{public_id}/restore")
def restore_trashed(db: Db, auth: CurrentUser, found: UserScope, public_id: str) -> Response:
entry: FormTrash | None = history.find_trash(db, auth.user, found.managed, public_id)
if entry is None:
raise NotFound()
try:
form = history.restore_trashed(db, entry, auth.user)
except history.HistoryError:
db.rollback()
return RedirectResponse("/forms?problem=trash_gone", status_code=303)
audit.record(db, "form.trash_restored", actor_id=auth.user.id, target_type="form",
target_id=form.id)
db.commit()
return RedirectResponse(f"/forms/{form.public_id}?notice=form_restored", status_code=303)
+7 -7
View File
@@ -17,7 +17,7 @@ from surveybox.media.service import MediaError
from surveybox.models import Form as FormModel
from surveybox.models import MediaKind, Question
from surveybox.web.deps import AppSettings, Db, NotFound
from surveybox.web.form_deps import EditForm, EvalForm
from surveybox.web.form_deps import ChangedForm, EvalForm
from surveybox.web.media_response import media_response
router = APIRouter(prefix="/forms", include_in_schema=False)
@@ -76,7 +76,7 @@ def _clean_alt(value: str) -> str:
def add_image(
db: Db,
settings: AppSettings,
form: EditForm,
form: ChangedForm,
question_id: int,
image: UploadFile,
alt: Text = "",
@@ -110,7 +110,7 @@ def add_image(
@router.post("/{public_id}/questions/{question_id}/media/image/{media_id}")
def update_image(
db: Db,
form: EditForm,
form: ChangedForm,
question_id: int,
media_id: str,
action: Annotated[str, Form(max_length=10)],
@@ -145,7 +145,7 @@ def update_image(
def add_video(
db: Db,
settings: AppSettings,
form: EditForm,
form: ChangedForm,
question_id: int,
video: UploadFile | None = None,
poster: UploadFile | None = None,
@@ -198,7 +198,7 @@ def add_video(
@router.post("/{public_id}/questions/{question_id}/media/video/remove")
def remove_video_part(
db: Db, form: EditForm, question_id: int, part: Annotated[str, Form(max_length=10)]
db: Db, form: ChangedForm, question_id: int, part: Annotated[str, Form(max_length=10)]
) -> Response:
question = _question(form, question_id)
current = dict(question.config.get("media") or {})
@@ -216,7 +216,7 @@ def remove_video_part(
def add_embed(
db: Db,
settings: AppSettings,
form: EditForm,
form: ChangedForm,
question_id: int,
url: Annotated[str, Form(max_length=500)],
title: Text = "",
@@ -234,7 +234,7 @@ def add_embed(
@router.post("/{public_id}/questions/{question_id}/media/clear")
def clear_media(db: Db, form: EditForm, question_id: int) -> Response:
def clear_media(db: Db, form: ChangedForm, question_id: int) -> Response:
question = _question(form, question_id)
_set_media(question, None)
media_service.drop_unused(db, question)
+8 -2
View File
@@ -15,6 +15,7 @@ from surveybox.forms import (
erasure,
evaluation,
export,
history,
notes,
pdf_export,
retention,
@@ -200,11 +201,13 @@ def delete_response(
f"/forms/{form.public_id}/responses/{response_id}?error=confirm#delete",
status_code=303)
public_id = response.public_id
erasure.delete_response(db, settings, response)
history.before_change(db, form, auth.user, "answer_delete")
erasure.delete_response(db, settings, response, by_manager=True)
audit.record(db, "response.deleted", actor_id=auth.user.id, target_type="form",
target_id=form.id)
db.commit()
erasure_journal.record(settings, "response", public_id)
# Von Verwaltern gelöscht: bleibt im Verlauf wiederherstellbar
erasure_journal.record(settings, "response", public_id, by="manager")
return RedirectResponse(f"/forms/{form.public_id}/responses?notice=response_deleted",
status_code=303)
@@ -252,6 +255,8 @@ def save_response(
page = {**_edit_page_context(db, form, response), "note_value": note,
"note_error": NOTE_ERRORS[error] if error else None}
before = service.display_rows(form, response, settings.tz)
if error is None:
history.before_change(db, form, auth.user, "answer_edit")
failed = fill.save_edit_for(request, db, settings, form, response, fields, files,
action_url=_edit_url(form, response), page=page,
blocked=error is not None)
@@ -260,6 +265,7 @@ def save_response(
db.flush()
changed = notes.changed_labels(before, service.display_rows(form, response, settings.tz))
notes.add(db, response, auth.user, note, changed)
response.edited_by = "manager"
audit.record(db, "response.edited", actor_id=auth.user.id, target_type="form",
target_id=form.id, details={"questions": len(changed)})
db.commit()
+15 -7
View File
@@ -18,6 +18,7 @@ from surveybox.forms import (
comments,
conditions,
groups,
history,
retention,
service,
team,
@@ -42,7 +43,8 @@ from surveybox.web.deps import (
UserScope,
)
from surveybox.web.fill_page import render_fill
from surveybox.web.form_deps import EditForm, EvalForm, OwnForm
from surveybox.web.form_deps import ChangedForm, EditForm, EvalForm, OwnForm
from surveybox.web.routes.form_history import trash_entries
from surveybox.web.routes.form_media import apply_option_images
from surveybox.web.templating import render
@@ -160,6 +162,7 @@ def _designer(
"group_of": groups.member_of(form.questions),
"required_by_group": groups.required_by_group(form.questions),
"member_types": groups.MEMBER_TYPES,
"overbooked": history.overbooked(db, form),
**extra,
},
status_code=status_code,
@@ -173,6 +176,9 @@ def _designer(
@router.get("")
def list_forms(request: Request, db: Db, auth: CurrentUser, found: UserScope) -> Response:
if request.query_params.get("problem") == "trash_gone":
return _list_page(request, db, auth, found,
trash_error=N_("This form can no longer be restored."))
return _list_page(request, db, auth, found)
@@ -191,6 +197,7 @@ def _list_page(
"can_create": found.can_create_forms,
"group_choices": scope.creatable_groups(db, found),
"group_required": not found.global_creator,
"trash": trash_entries(db, auth.user, found.managed),
**extra,
},
status_code=status_code,
@@ -508,7 +515,7 @@ def update_question(
request: Request,
db: Db,
settings: AppSettings,
form: EditForm,
form: ChangedForm,
question_id: int,
fields: FormFields,
files: FormFiles,
@@ -553,7 +560,7 @@ def update_question(
def delete_question(
request: Request,
db: Db,
form: EditForm,
form: ChangedForm,
question_id: int,
confirm: Annotated[str, Form(max_length=5)] = "",
) -> Response:
@@ -660,6 +667,7 @@ def _settings_page(
"has_responses": service.response_count(db, form) > 0,
"retention_default": retention.default_days(db),
"retention_date": retention.planned_date(db, form),
"trash_days": history.trash_days(db),
**extra,
},
status_code=status_code,
@@ -678,7 +686,7 @@ def save_settings(
request: Request,
db: Db,
settings: AppSettings,
form: EditForm,
form: ChangedForm,
fields: FormFields,
found: UserScope,
) -> Response:
@@ -733,7 +741,7 @@ def access_form(request: Request, db: Db, form: EditForm, found: UserScope) -> R
@router.post("/{public_id}/access")
def save_access(db: Db, form: EditForm, fields: FormFields, found: UserScope) -> Response:
def save_access(db: Db, form: ChangedForm, fields: FormFields, found: UserScope) -> Response:
service.set_access_entries(
db, form, fields.get("users") or [], fields.get("groups") or [], found
)
@@ -801,6 +809,6 @@ def delete_form(
request, db, settings, form, delete_error=_error("confirm_missing"), status_code=400
)
audit.record(db, "form.deleted", actor_id=auth.user.id, target_type="form", target_id=form.id)
service.delete_form(db, form)
history.trash_form(db, form, auth.user) # bleibt eine Weile wiederherstellbar
db.commit()
return RedirectResponse("/forms?notice=form_deleted", status_code=303)
return RedirectResponse("/forms?notice=form_trashed", status_code=303)
+10
View File
@@ -557,3 +557,13 @@ input[type="file"]::file-selector-button {
.open-tab { color: var(--sb-muted); font-size: 0.8125rem; white-space: nowrap; }
body.compact .content { margin-top: 16px; margin-bottom: 16px; }
body.compact .card { padding: 16px 20px; }
/* Verlauf und Überbuchung */
.badge.warn { color: var(--sb-error); border-color: var(--sb-error); }
.history-group { margin: 0 0 16px; }
.history-group h3 { margin: 16px 0 8px; font-size: 1rem; }
.history-item { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid var(--sb-border); }
.history-item .hint { margin: 2px 0 0; }
.history-values { display: grid; grid-template-columns: max-content 1fr; gap: 2px 8px; font-size: 0.875rem; margin-top: 4px; }
.history-values dt { color: var(--sb-muted); }
.history-values dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
@@ -71,4 +71,18 @@
<button type="submit">{{ _('Save') }}</button>
</form>
</section>
<section class="card narrow" id="history">
<h2>{{ _('Form history and trash') }}</h2>
{% if history_error %}<p class="alert error" role="alert">{{ _('The history can be kept for %(a)d to %(b)d days, the trash for %(c)d to %(d)d days.', a=history_range[0], b=history_range[1], c=trash_range[0], d=trash_range[1]) }}</p>{% endif %}
<form method="post" action="/admin/settings/history" class="form">
{{ csrf_field(request) }}
<label for="history_days">{{ _('Keep saved states of forms for … days') }}</label>
<input id="history_days" name="history_days" type="number" min="{{ history_range[0] }}" max="{{ history_range[1] }}" required value="{{ history_days }}">
<p class="hint">{{ _('States are saved before changes to questions, options, settings and access, before managers change or delete answers, and once a day if a form changed. Managers use them to restore individual questions, options, settings or answers. They contain the answers, so they never outlast them: when a form is deleted or its retention period ends, its states are deleted too.') }}</p>
<label for="trash_days">{{ _('Keep deleted forms in the trash for … days') }}</label>
<input id="trash_days" name="trash_days" type="number" min="{{ trash_range[0] }}" max="{{ trash_range[1] }}" required value="{{ trash_days }}">
<p class="hint">{{ _('During this time the owner, the person who deleted it, group administrators and administrators can restore a deleted form with all questions and answers. Afterwards it is deleted for good. If a person is deleted, their answers are also removed from the trash and the history at once.') }}</p>
<button type="submit">{{ _('Save') }}</button>
</form>
</section>
{% endblock %}
@@ -15,6 +15,11 @@
{% set is_owner = request.state.form_level >= 3 %}
{% set is_creator = user.role in ('admin', 'creator') %}
{% if error %}<p class="alert error" role="alert">{{ _(error) }}</p>{% endif %}
{% if overbooked %}
<div class="alert warn" role="status">
<p>{{ _('More places are booked than available:') }} {{ overbooked | join('; ') }}</p>
</div>
{% endif %}
<section class="card">
<div class="inline-actions">
@@ -24,6 +29,7 @@
<a class="button secondary" href="/forms/{{ form.public_id }}/responses">{{ _('Answers') }} ({{ responses }})</a>
{% endif %}
{% if is_owner %}<a class="button secondary" href="/forms/{{ form.public_id }}/team">{{ _('Team') }}</a>{% endif %}
{% if request.state.form_level >= 2 %}<a class="button secondary" href="/forms/{{ form.public_id }}/history">{{ _('History') }}</a>{% endif %}
{% if not form.is_template %}<a class="button secondary" href="/forms/{{ form.public_id }}/followups">{{ _('Follow-up emails') }}</a>{% endif %}
{% if form.comments_mode != 'off' and not form.is_template %}<a class="button secondary" href="/forms/{{ form.public_id }}/comments">{{ _('Comments') }}{% if pending_comments %} ({{ ngettext('%(num)d new', '%(num)d new', pending_comments) }}){% endif %}</a>{% endif %}
{% if is_creator %}
+37
View File
@@ -0,0 +1,37 @@
{% extends "base.html" %}
{% block title %}{{ _('History') }} · {{ form.title }} · {{ appearance.name }}{% endblock %}
{% block content %}
<p><a href="/forms/{{ form.public_id }}">← {{ form.title }}</a></p>
<h1>{{ _('History') }}</h1>
{% if overbooked %}
<div class="alert warn" role="status">
<p>{{ _('More places are booked than available:') }}</p>
<ul>{% for name in overbooked %}<li>{{ name }}</li>{% endfor %}</ul>
<p>{{ _('Nobody was moved to the waiting list. Raise the number of places or contact the people concerned.') }}</p>
</div>
{% endif %}
<section class="card">
<p>{{ _('Surveybox saves the state of this form before questions, options, settings or access are changed, before a manager changes or deletes an answer, and once a day if anything changed. Choose a state to see what differs from now and to restore individual questions, options, settings or answers. Everything else stays as it is.') }}</p>
<p class="hint">{{ ngettext('States are kept for %(num)d day, at most as long as the answers themselves.', 'States are kept for %(num)d days, at most as long as the answers themselves.', history_days) }} {{ _('Changes and deletions by participants themselves are not restored; what participants delete also disappears from the history.') }}</p>
{% if snapshots %}
<div class="table-wrap">
<table class="table">
<thead><tr><th>{{ _('Saved') }}</th><th>{{ _('Occasion') }}</th><th>{{ _('By') }}</th><th></th></tr></thead>
<tbody>
{% for s in snapshots %}
<tr>
<td>{{ s.created_at | datetime }}</td>
<td>{{ _(reason_names.get(s.reason, s.reason)) }}</td>
<td>{% if s.actor_id %}{{ actors.get(s.actor_id, _('Deleted user')) }}{% else %}–{% endif %}</td>
<td><a href="/forms/{{ form.public_id }}/history/{{ s.id }}">{{ _('Compare') }}</a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p class="hint">{{ _('No states yet. The first one is saved with the next change.') }}</p>
{% endif %}
</section>
{% endblock %}
@@ -0,0 +1,102 @@
{% extends "base.html" %}
{% block title %}{{ _('History') }} · {{ form.title }} · {{ appearance.name }}{% endblock %}
{% macro value(v) -%}
{%- if v is none or v == '' -%}<em>{{ _('empty') }}</em>
{%- elif v is sameas true -%}{{ _('Yes') }}
{%- elif v is sameas false -%}{{ _('No') }}
{%- elif v.tzinfo is defined and v.hour is defined -%}{{ v | datetime }}
{%- else -%}{{ v }}{%- endif -%}
{%- endmacro %}
{% block content %}
<p><a href="/forms/{{ form.public_id }}/history">← {{ _('History') }}</a></p>
<h1>{{ _('State of %(date)s', date=snapshot.created_at | datetime) }}</h1>
<p class="hint">{{ _(reason_names.get(snapshot.reason, snapshot.reason)) }}{% if actor %} · {{ actor }}{% endif %}</p>
{% if error %}<p class="alert error" role="alert">{{ _(error) }}</p>{% endif %}
{% if comparison.empty %}
<section class="card">
<p>{{ _('Nothing in this state differs from the form as it is now in a way that can be restored.') }}</p>
</section>
{% else %}
<form method="post" action="/forms/{{ form.public_id }}/history/{{ snapshot.id }}/restore" class="card">
{{ csrf_field(request) }}
<p>{{ _('Choose what to restore. Only the chosen items change; questions, answers and settings that are not chosen stay as they are now.') }}</p>
{% if comparison.settings %}
<div class="history-group">
<h2>{{ _('Settings') }}</h2>
{% for item in comparison.settings %}
<label class="history-item">
<input type="checkbox" name="item" value="{{ item.key }}" {% if item.key in selected %}checked{% endif %}>
<span>
{% if item.kind == 'access' %}
<strong>{{ _('Access for people and groups') }}</strong>
<span class="hint">{{ _('Then: %(old)d entries, now: %(new)d entries', old=item.old, new=item.new) }}</span>
{% else %}
<strong>{{ _(item.title) }}</strong>
{% if item.old is not none or item.new is not none %}
<dl class="history-values">
<dt>{{ _('Then') }}</dt><dd>{{ value(item.old) }}</dd>
<dt>{{ _('Now') }}</dt><dd>{{ value(item.new) }}</dd>
</dl>
{% else %}
<span class="hint">{{ _('changed') }}</span>
{% endif %}
{% endif %}
</span>
</label>
{% endfor %}
</div>
{% endif %}
{% if comparison.questions %}
<div class="history-group">
<h2>{{ _('Questions and options') }}</h2>
{% for item in comparison.questions %}
<label class="history-item">
<input type="checkbox" name="item" value="{{ item.key }}" {% if item.key in selected %}checked{% endif %}>
<span>
{% if item.kind == 'question_deleted' %}
<strong>{{ item.title }}</strong> <span class="badge">{{ _('deleted') }}</span>
<span class="hint">{{ ngettext('With %(num)d answer', 'With %(num)d answers', item.answers) }}{% if item.bookings %} · {{ ngettext('%(num)d booked place', '%(num)d booked places', item.bookings) }}{% endif %}</span>
{% elif item.kind == 'question_changed' %}
<strong>{{ item.title }}</strong> <span class="badge">{{ _('changed') }}</span>
<span class="hint">{{ _('Text, settings and options as they were then. Options added since are kept; removed options are listed separately.') }}</span>
{% else %}
<strong>{{ item.title }}</strong> <span class="badge">{{ _('option removed') }}</span>
<span class="hint">{{ _('Question: %(question)s', question=item.question) }}{% if item.bookings %} · {{ ngettext('%(num)d booked place', '%(num)d booked places', item.bookings) }}{% endif %}</span>
{% endif %}
</span>
</label>
{% endfor %}
</div>
{% endif %}
{% if comparison.responses %}
<div class="history-group">
<h2>{{ _('Answers') }}</h2>
{% for item in comparison.responses %}
<label class="history-item">
<input type="checkbox" name="item" value="{{ item.key }}" {% if item.key in selected %}checked{% endif %}>
<span>
<strong>{{ item.title or _('Answer without name') }}</strong>
{% if item.kind == 'response_deleted' %}
<span class="badge">{{ _('deleted by a manager') }}</span>
<span class="hint">{{ _('Submitted %(date)s', date=item.when | datetime) }} · {{ ngettext('%(num)d answered question', '%(num)d answered questions', item.answers) }}{% if item.bookings %} · {{ ngettext('%(num)d booked place', '%(num)d booked places', item.bookings) }}{% endif %}</span>
{% else %}
<span class="badge">{{ _('changed by a manager') }}</span>
<span class="hint">{{ _('Changed %(date)s', date=item.when | datetime) }} · {{ ngettext('%(num)d question differs', '%(num)d questions differ', item.answers) }}</span>
{% endif %}
</span>
</label>
{% endfor %}
</div>
{% endif %}
<p class="hint">{{ _('Before restoring, the current state is saved too, so this step can be undone in the history. Booked places are restored even if there are not enough places any more; the option is then shown as overbooked.') }}</p>
<button type="submit">{{ _('Restore selected') }}</button>
</form>
{% endif %}
{% endblock %}
+2 -2
View File
@@ -104,7 +104,7 @@
{% for item in lists %}
<tr>
<th scope="row">{{ item.text }}</th>
<td class="num">{{ item.confirmed | length }}{% if item.capacity %} / {{ item.capacity }}{% endif %}</td>
<td class="num">{{ item.confirmed | length }}{% if item.capacity %} / {{ item.capacity }}{% if item.confirmed | length > item.capacity | int %} <span class="badge warn">{{ _('overbooked') }}</span>{% endif %}{% endif %}</td>
<td>{{ item.confirmed | join(', ') or '–' }}</td>
<td>{{ item.waiting | join(', ') or '–' }}</td>
</tr>
@@ -118,7 +118,7 @@
<tr>
<th scope="row">{{ row.text }}</th>
<td>{% if row.capacity %}<progress max="{{ row.capacity }}" value="{{ row.confirmed }}">{{ row.confirmed }}</progress>{% endif %}</td>
<td class="num">{{ row.confirmed }}{% if row.capacity %} / {{ row.capacity }}{% endif %}{% if row.waiting %} · {{ ngettext('%(num)d waiting', '%(num)d waiting', row.waiting) }}{% endif %}</td>
<td class="num">{{ row.confirmed }}{% if row.capacity %} / {{ row.capacity }}{% if row.confirmed > row.capacity | int %} <span class="badge warn">{{ _('overbooked') }}</span>{% endif %}{% endif %}{% if row.waiting %} · {{ ngettext('%(num)d waiting', '%(num)d waiting', row.waiting) }}{% endif %}</td>
</tr>
{% endfor %}
</tbody>
@@ -160,6 +160,7 @@
{% if delete_error %}<p class="alert error" role="alert">{{ _(delete_error) }}</p>{% endif %}
<form method="post" action="/forms/{{ form.public_id }}/delete" class="form">
{{ csrf_field(request) }}
<p class="hint">{{ ngettext('The form goes to the trash in the form list. There you can restore it for %(num)d day; after that it is deleted for good.', 'The form goes to the trash in the form list. There you can restore it for %(num)d days; after that it is deleted for good.', trash_days) }}</p>
<label class="check"><input type="checkbox" name="confirm" required> {{ _('Yes, delete this form with all questions and answers.') }}</label>
<button type="submit" class="danger">{{ _('Delete form') }}</button>
</form>
+27
View File
@@ -26,6 +26,33 @@
</tbody>
</table>
</section>
{% if trash or trash_error %}
<section class="card">
<h2>{{ _('Trash') }}</h2>
{% if trash_error %}<p class="alert error" role="alert">{{ _(trash_error) }}</p>{% endif %}
<p class="hint">{{ _('Deleted forms can be restored with all questions and answers until the date shown. After that they are deleted for good.') }}</p>
{% if trash %}
<table class="table">
<thead><tr><th>{{ _('Title') }}</th><th>{{ _('Answers') }}</th><th>{{ _('Deleted') }}</th><th>{{ _('Restorable until') }}</th><th></th></tr></thead>
<tbody>
{% for t in trash %}
<tr>
<td>{{ t.entry.title }}{% if t.entry.extra.get('is_template') %} <span class="badge">{{ _('Template') }}</span>{% endif %}</td>
<td>{{ t.entry.responses }}</td>
<td>{{ t.entry.deleted_at | datetime }}</td>
<td>{{ t.expires | date }}</td>
<td>
<form method="post" action="/forms/trash/{{ t.entry.public_id }}/restore" class="inline">
{{ csrf_field(request) }}<button type="submit" class="secondary">{{ _('Restore') }}</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</section>
{% endif %}
{% if can_create %}
{% if templates %}
<section class="card">
+5
View File
@@ -44,6 +44,11 @@ NOTICES: dict[str, str] = {
"group_deleted": N_("The group has been deleted."),
"form_saved": N_("The form has been saved."),
"form_deleted": N_("The form has been deleted."),
"form_trashed": N_(
"The form has been moved to the trash. It can be restored there for a limited time."
),
"form_restored": N_("The form has been restored from the trash."),
"history_restored": N_("The selected changes have been restored."),
"form_copied": N_("The copy has been created. It is a draft."),
"template_saved": N_(
"The template has been saved. New forms can be created from it in the form list."
+16
View File
@@ -45,6 +45,9 @@ DEADLINE_INTERVAL = timedelta(minutes=5)
# Nur Enddaten der letzten Tage melden (z. B. nach einer Pause des Workers)
DEADLINE_LOOKBACK = timedelta(days=3)
DIGEST_JOB = "digest"
# Verlauf der Formulare: täglicher Stand, abgelaufene Stände und Papierkorb
HISTORY_JOB = "form_history"
HISTORY_INTERVAL = timedelta(hours=24)
DIGEST_HOUR = 7
@@ -100,6 +103,8 @@ class Worker:
self.run_daily_backup(now)
if self.cleanup_due(now):
self.run_cleanup(now)
if self._due(HISTORY_JOB, HISTORY_INTERVAL, now):
self.run_history(now)
if self._due(DEADLINE_JOB, DEADLINE_INTERVAL, now):
self.run_deadlines(now)
if self.digest_due(now):
@@ -242,6 +247,17 @@ class Worker:
self._record(CLEANUP_JOB, started=now, finished=datetime.now(UTC), status="ok",
message=message, success=True)
def run_history(self, now: datetime) -> None:
"""Täglicher Stand geänderter Formulare; Abgelaufenes entfernen."""
from surveybox.forms import history
with Session(self.engine) as db, db.begin():
removed = history.prune(db, now)
with Session(self.engine) as db, db.begin():
created = history.daily(db, now)
self._record(HISTORY_JOB, started=now, finished=datetime.now(UTC), status="ok",
message=f"snapshots={created} removed={removed}", success=True)
def daily_backup_due(self, now: datetime) -> bool:
local = now.astimezone(self.settings.tz)
if local.hour < self.settings.backup_hour:
+337
View File
@@ -0,0 +1,337 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
"""Verlauf und Papierkorb gegen PostgreSQL: punktuell wiederherstellen, Überbuchung,
Löschen durch Teilnehmende, gelöschte Personen, Aufbewahrung (CI)."""
from __future__ import annotations
from datetime import UTC, datetime, timedelta
from typing import Any
import pytest
pytest.importorskip("fastapi")
from fastapi.testclient import TestClient
from helpers import new_client, token_for
from sqlalchemy import func, select, update
from sqlalchemy.orm import Session
from test_forms import (
creator,
fill,
form_row,
participant,
question_ids,
save_settings,
simple_form,
)
from test_mail import admin
from test_phase5 import bookings, options_of, slot_form
from surveybox import db
from surveybox.forms import erasure, history
from surveybox.models import (
Answer,
Form,
FormSnapshot,
FormTrash,
Response,
UserAccount,
)
from surveybox.settings import get_settings
pytestmark = pytest.mark.db
def snapshots(pid: str) -> list[tuple[int, str, history.Payload]]:
"""(Kennung, Anlass, Inhalt) aller Stände eines Formulars, älteste zuerst."""
form_id = form_row(pid).id
with Session(db.get_engine()) as s:
rows = list(s.scalars(select(FormSnapshot).where(FormSnapshot.form_id == form_id)
.order_by(FormSnapshot.created_at, FormSnapshot.id)))
return [(r.id, r.reason, history.unpack(r)) for r in rows]
def responses_of(pid: str) -> list[Response]:
with Session(db.get_engine()) as s:
rows = list(s.scalars(select(Response).where(Response.form_id == form_row(pid).id)
.order_by(Response.id)))
for row in rows:
s.expunge(row)
return rows
def restore(client: TestClient, pid: str, snapshot_id: int, *items: str) -> Any:
url = f"/forms/{pid}/history/{snapshot_id}"
return client.post(f"{url}/restore",
data={"csrf_token": token_for(client, url), "item": list(items)})
def remove_option(client: TestClient, pid: str, qid: int, keep: str) -> None:
csrf = token_for(client, f"/forms/{pid}/questions/{qid}")
resp = client.post(f"/forms/{pid}/questions/{qid}", data={
"csrf_token": csrf, "label": "Schicht", "slot_mode": "list",
"option_id": [keep], "option_label": ["Spät"], "option_capacity": [""]})
assert resp.status_code == 303, resp.text
# --------------------------------------------------------------------------
# Der Fall aus der Praxis: gebuchte Option gelöscht, einzeln zurückholen
# --------------------------------------------------------------------------
def test_restore_deleted_booked_option_only(app: Any) -> None:
owner = creator(app)
pid, token, qid, (early, late) = slot_form(owner, capacity="2")
assert fill(new_client(app), token, {f"q{qid}": early}).status_code == 303 # Anna
assert fill(new_client(app), token, {f"q{qid}": late}).status_code == 303 # Bert
remove_option(owner, pid, qid, late)
assert [b[0] for b in bookings(qid)] == [late]
# Danach geht es weiter: neue Antwort, neuer Titel
assert fill(new_client(app), token, {f"q{qid}": late}).status_code == 303 # Carl
assert save_settings(owner, pid, title="Herbstfest", access="link").status_code == 303
found = [s for s in snapshots(pid)
if any(o.get("id") == early for q in s[2].rows("question")
for o in (q["config"] or {}).get("options") or [])]
snapshot_id = found[-1][0] # der Stand direkt vor dem Streichen
page = owner.get(f"/forms/{pid}/history/{snapshot_id}").text
assert f'value="opt:{qid}:{early}"' in page and "Früh" in page
assert "1 booked place" in page
resp = restore(owner, pid, snapshot_id, f"opt:{qid}:{early}")
assert resp.status_code == 303 and "history_restored" in resp.headers["location"]
assert [o["id"] for o in options_of(qid)] == [early, late]
assert sorted(b[0] for b in bookings(qid)) == sorted([early, late, late])
# Alles andere bleibt, wie es ist
assert form_row(pid).title == "Herbstfest"
assert len(responses_of(pid)) == 3
# Vorher wurde der jetzige Stand gesichert
assert snapshots(pid)[-1][1] == "before_restore"
def test_restore_nothing_selected(app: Any) -> None:
owner = creator(app)
pid, _, qid, (_, late) = slot_form(owner)
remove_option(owner, pid, qid, late)
snapshot_id = snapshots(pid)[-1][0]
resp = restore(owner, pid, snapshot_id)
assert resp.status_code == 400 and "Please choose at least one" in resp.text
resp = restore(owner, pid, snapshot_id, "opt:999:x", "setting:status")
assert resp.status_code == 400
# --------------------------------------------------------------------------
# Antworten: von Verwaltern gelöscht, zurück trotz voller Plätze
# --------------------------------------------------------------------------
def test_restore_deleted_answer_overbooks(app: Any) -> None:
owner = creator(app)
pid, token, qid, (early, _) = slot_form(owner, capacity="1")
assert fill(new_client(app), token, {f"q{qid}": early}).status_code == 303
(first,) = responses_of(pid)
url = f"/forms/{pid}/responses/{first.public_id}"
resp = owner.post(f"{url}/delete", data={"csrf_token": token_for(owner, url),
"confirm": "on"})
assert resp.status_code == 303
# Der frei gewordene Platz ist inzwischen vergeben
assert fill(new_client(app), token, {f"q{qid}": early}).status_code == 303
snapshot_id, reason, _ = snapshots(pid)[-1]
assert reason == "answer_delete"
page = owner.get(f"/forms/{pid}/history/{snapshot_id}").text
assert f'value="r_del:{first.id}"' in page
assert restore(owner, pid, snapshot_id, f"r_del:{first.id}").status_code == 303
assert len(responses_of(pid)) == 2
assert [b[:2] for b in bookings(qid)] == [(early, "confirmed"), (early, "confirmed")]
assert "More places are booked than available" in owner.get(f"/forms/{pid}/history").text
assert "More places are booked than available" in owner.get(f"/forms/{pid}").text
assert "overbooked" in owner.get(f"/forms/{pid}/responses").text
def test_restore_deleted_question_with_answers(app: Any) -> None:
owner = creator(app)
pid, token, (q_name, q_food) = simple_form(owner, access="link")
for name in ("Anna", "Bert"):
assert fill(new_client(app), token, {f"q{q_name}": name}).status_code == 303
csrf = token_for(owner, f"/forms/{pid}/questions/{q_name}")
resp = owner.post(f"/forms/{pid}/questions/{q_name}/delete",
data={"csrf_token": csrf, "confirm": "on"})
assert resp.status_code == 303
assert question_ids(pid) == [q_food]
snapshot_id = snapshots(pid)[-1][0]
assert "With 2 answers" in owner.get(f"/forms/{pid}/history/{snapshot_id}").text
assert restore(owner, pid, snapshot_id, f"q_del:{q_name}").status_code == 303
assert question_ids(pid) == [q_name, q_food] # wieder an erster Stelle
with Session(db.get_engine()) as s:
texts = sorted(s.scalars(select(Answer.value_text).where(Answer.question_id == q_name)))
assert texts == ["Anna", "Bert"]
def test_restore_setting_only(app: Any) -> None:
owner = creator(app)
pid, _, _ = simple_form(owner, access="link")
assert save_settings(owner, pid, title="Neu", access="link",
closes_at="2030-01-01T10:00").status_code == 303
snapshot_id = snapshots(pid)[-1][0]
page = owner.get(f"/forms/{pid}/history/{snapshot_id}").text
assert 'value="setting:title"' in page and 'value="setting:closes_at"' in page
assert restore(owner, pid, snapshot_id, "setting:title").status_code == 303
row = form_row(pid)
assert row.title == "Sommerfest" and row.closes_at is not None
def test_participant_edits_are_not_offered(app: Any) -> None:
owner = creator(app)
pid, token, (q_name, _) = simple_form(owner, access="users")
paul = participant(app)
assert fill(paul, token, {f"q{q_name}": "Paul"}).status_code == 303
assert save_settings(owner, pid, title="Neu").status_code == 303 # neuer Stand
assert fill(paul, token, {f"q{q_name}": "Paula"}, path="/edit").status_code == 303
snapshot_id = snapshots(pid)[-1][0]
assert "r_chg:" not in owner.get(f"/forms/{pid}/history/{snapshot_id}").text
def test_history_needs_edit_rights(app: Any) -> None:
from test_media_team import add_member
owner = creator(app)
pid, _, _ = simple_form(owner, access="link")
assert save_settings(owner, pid, title="Neu", access="link").status_code == 303
snapshot_id = snapshots(pid)[-1][0]
editor = participant(app, "erik@example.de")
evaluator = participant(app, "eva@example.de")
add_member(owner, pid, "erik@example.de", "editor")
add_member(owner, pid, "eva@example.de", "evaluator")
assert editor.get(f"/forms/{pid}/history").status_code == 200
assert editor.get(f"/forms/{pid}/history/{snapshot_id}").status_code == 200
for other in (evaluator, participant(app)):
assert other.get(f"/forms/{pid}/history").status_code in (403, 404)
assert other.get(f"/forms/{pid}/history/{snapshot_id}").status_code in (403, 404)
# --------------------------------------------------------------------------
# Datenschutz
# --------------------------------------------------------------------------
def test_self_deleted_answer_leaves_history(app: Any) -> None:
owner = creator(app)
pid, token, (q_name, _) = simple_form(owner, access="link")
assert fill(new_client(app), token, {f"q{q_name}": "Anna"}).status_code == 303
assert save_settings(owner, pid, title="Neu", access="link").status_code == 303
(response,) = responses_of(pid)
assert any(r["id"] == response.id for _, _, p in snapshots(pid) for r in p.rows("response"))
with Session(db.get_engine()) as s:
row = s.get(Response, response.id)
assert row is not None
erasure.delete_response(s, get_settings(), row) # wie über den persönlichen Link
s.commit()
assert not any(p.rows("response") for _, _, p in snapshots(pid))
snapshot_id = snapshots(pid)[-1][0]
assert "r_del:" not in owner.get(f"/forms/{pid}/history/{snapshot_id}").text
def test_erased_user_leaves_history(app: Any) -> None:
owner = creator(app)
pid, token, (q_name, _) = simple_form(owner, access="users", deletion_mode="delete")
paul = participant(app)
assert fill(paul, token, {f"q{q_name}": "Paul"}).status_code == 303
assert save_settings(owner, pid, title="Neu", deletion_mode="delete").status_code == 303
with Session(db.get_engine()) as s:
user = s.scalar(select(UserAccount).where(UserAccount.email == "paul@example.de"))
assert user is not None
user_id = user.id
erasure.erase_user(s, get_settings(), user, {}, actor_id=None)
s.commit()
for _, _, payload in snapshots(pid):
assert not any(r.get("user_id") == user_id for r in payload.rows("response"))
with Session(db.get_engine()) as s:
assert not s.scalar(select(func.count()).select_from(FormSnapshot)
.where(FormSnapshot.user_ids.contains([user_id])))
def test_retention_removes_history(app: Any) -> None:
from surveybox.forms import retention
owner = creator(app)
pid, token, (q_name, _) = simple_form(owner, access="link")
assert fill(new_client(app), token, {f"q{q_name}": "Anna"}).status_code == 303
assert save_settings(owner, pid, title="Neu", access="link").status_code == 303
assert snapshots(pid)
with Session(db.get_engine()) as s:
form = s.get(Form, form_row(pid).id)
assert form is not None
retention.apply(s, form, datetime.now(UTC))
s.commit()
assert snapshots(pid) == []
# --------------------------------------------------------------------------
# Papierkorb und Aufbewahrung
# --------------------------------------------------------------------------
def test_trash_and_restore_form(app: Any) -> None:
owner = creator(app)
pid, token, (q_name, q_food) = simple_form(owner, access="link")
assert fill(new_client(app), token, {f"q{q_name}": "Anna"}).status_code == 303
csrf = token_for(owner, f"/forms/{pid}/settings")
resp = owner.post(f"/forms/{pid}/delete", data={"csrf_token": csrf, "confirm": "on"})
assert resp.status_code == 303 and "form_trashed" in resp.headers["location"]
assert new_client(app).get(f"/f/{token}").status_code == 404
listing = owner.get("/forms").text
assert "Trash" in listing and f"/forms/trash/{pid}/restore" in listing
# Andere sehen den Papierkorb nicht und können nichts zurückholen
other = creator(app, "otto@example.de")
assert f"/forms/trash/{pid}/restore" not in other.get("/forms").text
csrf = token_for(other, "/forms")
assert other.post(f"/forms/trash/{pid}/restore",
data={"csrf_token": csrf}).status_code == 404
csrf = token_for(owner, "/forms")
resp = owner.post(f"/forms/trash/{pid}/restore", data={"csrf_token": csrf})
assert resp.status_code == 303 and "form_restored" in resp.headers["location"]
assert question_ids(pid) == [q_name, q_food]
assert len(responses_of(pid)) == 1
assert new_client(app).get(f"/f/{token}").status_code == 200
with Session(db.get_engine()) as s:
assert s.scalar(select(func.count()).select_from(FormTrash)) == 0
def test_prune_expired(app: Any) -> None:
owner = creator(app)
pid, _, _ = simple_form(owner, access="link")
assert save_settings(owner, pid, title="Neu", access="link").status_code == 303
keep_pid, _, _ = simple_form(owner, access="link")
csrf = token_for(owner, f"/forms/{keep_pid}/settings")
owner.post(f"/forms/{keep_pid}/delete", data={"csrf_token": csrf, "confirm": "on"})
form_id = form_row(pid).id
old = datetime.now(UTC) - timedelta(days=history.DEFAULT_HISTORY_DAYS + 1)
with Session(db.get_engine()) as s:
s.execute(update(FormSnapshot).values(created_at=old))
s.execute(update(FormTrash).values(
deleted_at=datetime.now(UTC) - timedelta(days=history.DEFAULT_TRASH_DAYS + 1)))
s.commit()
assert history.prune(s, datetime.now(UTC)) >= 2
s.commit()
assert s.scalar(select(func.count()).select_from(FormSnapshot)) == 0
assert s.scalar(select(func.count()).select_from(FormTrash)) == 0
# Der tägliche Stand legt wieder einen an
assert history.daily(s, datetime.now(UTC)) == 1
s.commit()
assert s.scalar(select(FormSnapshot.form_id)) == form_id
assert history.daily(s, datetime.now(UTC)) == 0 # nichts geändert
def test_instance_settings(app: Any) -> None:
client = admin(app)
url = "/admin/settings"
resp = client.post(f"{url}/history", data={"csrf_token": token_for(client, url),
"history_days": "30", "trash_days": "7"})
assert resp.status_code == 303 and "settings_saved" in resp.headers["location"]
resp = client.post(f"{url}/history", data={"csrf_token": token_for(client, url),
"history_days": "0", "trash_days": "7"})
assert "error=history" in resp.headers["location"]
with Session(db.get_engine()) as s:
assert history.history_days(s) == 30 and history.trash_days(s) == 7
+132
View File
@@ -0,0 +1,132 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
"""Verlauf der Formulare ohne Datenbank: Kodierung, Prüfsummen, Vergleich, Bereinigung."""
from __future__ import annotations
import uuid
from datetime import UTC, date, datetime, time
from decimal import Decimal
from typing import Any
import pytest
pytest.importorskip("sqlalchemy")
from surveybox.forms import history
from surveybox.forms.booking import Availability
def test_values_survive_encoding() -> None:
values = [None, True, 3, 1.5, "Text", Decimal("12.500000"),
datetime(2026, 11, 26, 9, 30, tzinfo=UTC), date(2026, 11, 26), time(9, 30),
uuid.uuid4(), b"\x00\xffmarker", {"selected": ["a", "b"]}, ["x", 1]]
for value in values:
assert history.decode_value(history.encode_value(value)) == value
def payload(**tables: list[dict[str, Any]]) -> history.Payload:
return history.Payload(1, dict(tables))
def form_row(**values: Any) -> dict[str, Any]:
return {"id": 1, "title": "Sommerfest", "updated_at": datetime(2026, 1, 1, tzinfo=UTC),
**values}
def test_hash_ignores_updated_at_and_separates_answers() -> None:
base = payload(form=[form_row()], response=[{"id": 5, "form_id": 1}])
touched = payload(form=[form_row(updated_at=datetime(2026, 2, 1, tzinfo=UTC))],
response=[{"id": 5, "form_id": 1}])
assert history.pack(base).full_hash == history.pack(touched).full_hash
renamed = payload(form=[form_row(title="Herbstfest")], response=[{"id": 5, "form_id": 1}])
assert history.pack(base).full_hash != history.pack(renamed).full_hash
# Nur Einstellungen geändert: Antworten-Prüfsumme bleibt (Entprellen)
assert history.pack(base).data_hash == history.pack(renamed).data_hash
more = payload(form=[form_row()], response=[{"id": 5, "form_id": 1},
{"id": 6, "form_id": 1}])
assert history.pack(base).data_hash != history.pack(more).data_hash
def question(**values: Any) -> dict[str, Any]:
return {"id": 7, "label": "Schicht", "help_text": None, "required": False,
"personal": False, "config": {"options": [{"id": "a", "label": "Früh"},
{"id": "b", "label": "Spät"}]},
**values}
def test_removed_option_is_not_a_changed_question() -> None:
old = question()
fewer = question(config={"options": [{"id": "b", "label": "Spät"}]})
added = question(config={"options": [{"id": "a", "label": "Früh"},
{"id": "b", "label": "Spät"},
{"id": "c", "label": "Abend"}]})
relabeled = question(config={"options": [{"id": "a", "label": "Morgens"},
{"id": "b", "label": "Spät"}]})
confirmed = question(config={**old["config"], "confirmed": ["a"]})
assert not history._definition_differs(old, fewer)
assert not history._definition_differs(old, added)
assert not history._definition_differs(old, confirmed)
assert history._definition_differs(old, relabeled)
assert history._definition_differs(old, question(label="Dienst"))
def test_compare_lists_deleted_question_and_removed_option() -> None:
old = payload(form=[form_row()],
question=[question(position=0), question(id=8, label="Name", position=1)],
answer=[{"question_id": 8, "response_id": 1},
{"question_id": 7, "response_id": 1}],
booking=[{"question_id": 7, "option_id": "a", "response_id": 1}])
now = payload(form=[form_row()],
question=[question(position=0,
config={"options": [{"id": "b", "label": "Spät"}]})])
result = history.Comparison(snapshot=None) # type: ignore[arg-type]
history._compare_questions(old, now, result)
keys = {item.key: item for item in result.questions}
assert set(keys) == {"q_del:8", "opt:7:a"}
assert keys["q_del:8"].answers == 1
assert keys["opt:7:a"].bookings == 1 and keys["opt:7:a"].title == "Früh"
def test_settings_compare_only_known_fields() -> None:
old = payload(form=[form_row(closes_at=None, status="open")])
now = payload(form=[form_row(title="Neu", closes_at=datetime(2026, 12, 1, tzinfo=UTC),
status="closed")])
result = history.Comparison(snapshot=None) # type: ignore[arg-type]
history._compare_settings(old, now, result)
assert [i.key for i in result.settings] == ["setting:title", "setting:closes_at"]
def test_drop_responses_removes_dependent_rows() -> None:
data = payload(response=[{"id": 1}, {"id": 2}],
answer=[{"response_id": 1}, {"response_id": 2}],
booking=[{"response_id": 1}], response_note=[{"response_id": 1}],
media_file=[{"response_id": 1, "storage_key": "k1"},
{"response_id": None, "storage_key": "k2"}])
assert history._drop_responses(data, {1})
assert [r["id"] for r in data.rows("response")] == [2]
assert data.rows("answer") == [{"response_id": 2}]
assert data.rows("booking") == [] and data.rows("response_note") == []
assert [m["storage_key"] for m in data.rows("media_file")] == ["k2"]
assert not history._drop_responses(data, {99})
def test_people_index() -> None:
data = payload(form=[form_row(owner_id=3)],
response=[{"id": 1, "user_id": 4, "guest_contact_id": None},
{"id": 2, "user_id": None, "guest_contact_id": 9}],
response_note=[{"author_id": 5}], form_access=[{"user_id": None}])
assert history._people(data) == ([3, 4, 5], [9])
def test_conditions_on_missing_questions_are_dropped() -> None:
config = {"condition": {"mode": "all", "rules": [{"q": 3, "op": "eq", "value": "x"},
{"q": 4, "op": "eq", "value": "y"}]}}
cleaned = history._clean_conditions(config, {3})
assert [r["q"] for r in cleaned["condition"]["rules"]] == [3]
assert "condition" not in history._clean_conditions(config, set())
def test_overbooked() -> None:
assert Availability(capacity=1, confirmed=2, waiting=0).overbooked
assert not Availability(capacity=2, confirmed=2, waiting=1).overbooked
assert not Availability(capacity=None, confirmed=9, waiting=0).overbooked
+1 -1
View File
@@ -174,7 +174,7 @@ def test_protected_pages_need_login_and_rights(app: Any) -> None:
if denied.status_code == 303:
assert not denied.headers["location"].startswith(path), path
checked += 1
# Stand Phase 10: 38 geschützte Seiten; die Untergrenze fängt eine leere Erfassung ab
# Stand mit Verlauf: 40 geschützte Seiten; die Untergrenze fängt eine leere Erfassung ab
assert checked > 30, _describe(app)