]> git.ipfire.org Git - dbl.git/commitdiff
reports: Don't remember what got notified
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 16 Feb 2026 19:04:50 +0000 (19:04 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 16 Feb 2026 19:04:50 +0000 (19:04 +0000)
It is more useful to always receive an email with all open reports.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/database.sql
src/dbl/reports.py

index 26d328219857f5c867ae0ec902ff64bdb79482ea..70651ce21e8bf00c4afd92225b52acf613c2b21e 100644 (file)
@@ -2,10 +2,10 @@
 -- PostgreSQL database dump
 --
 
-\restrict 8YknpWlB9eR9ncLt3ecgbxk8MuuGNYlcvtjH1Z5RakC9PZdxunARHhe6aujfak2
+\restrict O4KmJp4fm1WQRL3AwvOlZctAfBgsUgl2VKAckcThLrnSZl3pdImWPTfY4j1qC83
 
--- Dumped from database version 17.6 (Debian 17.6-0+deb13u1)
--- Dumped by pg_dump version 17.6 (Debian 17.6-0+deb13u1)
+-- Dumped from database version 17.7 (Debian 17.7-0+deb13u1)
+-- Dumped by pg_dump version 17.7 (Debian 17.7-0+deb13u1)
 
 SET statement_timeout = 0;
 SET lock_timeout = 0;
@@ -281,8 +281,7 @@ CREATE TABLE public.reports (
     closed_by text,
     comment text DEFAULT ''::text NOT NULL,
     block boolean DEFAULT true,
-    accepted boolean DEFAULT false,
-    notified_at timestamp with time zone
+    accepted boolean DEFAULT false
 );
 
 
@@ -642,5 +641,5 @@ ALTER TABLE ONLY public.sources
 -- PostgreSQL database dump complete
 --
 
-\unrestrict 8YknpWlB9eR9ncLt3ecgbxk8MuuGNYlcvtjH1Z5RakC9PZdxunARHhe6aujfak2
+\unrestrict O4KmJp4fm1WQRL3AwvOlZctAfBgsUgl2VKAckcThLrnSZl3pdImWPTfY4j1qC83
 
index 6063528eae664594309a82330359eae3cd351a17..854bd817ed95689870e83bd59c815d4682158ae8 100644 (file)
@@ -87,21 +87,15 @@ class Reports(object):
                # Fetch all pending reports that have not been notified, yet
                reports = self.backend.db.fetch(
                        sqlmodel
-                       .update(
+                       .select(
                                Report,
                        )
-                       .values(
-                               notified_at = sqlmodel.func.current_timestamp(),
-                       )
                        .where(
                                # Reports must be open
                                Report.closed_at == None,
-
-                               # Reports must not have been notified, yet
-                               Report.notified_at == None,
                        )
-                       .returning(
-                               Report,
+                       .order_by(
+                               Report.reported_at
                        )
                )
 
@@ -278,9 +272,6 @@ class Report(sqlmodel.SQLModel, database.BackendMixin, table=True):
                        # Update the list's stats
                        self.list.update_stats()
 
-       # Notified At
-       notified_at: datetime.datetime | None = None
-
        def _send_opening_notification(self):
                """
                        Sends a notification to the reporter when this report is opened.