]> git.ipfire.org Git - dbl.git/commitdiff
api: Allow to disable the email notification on reports
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 10 Mar 2026 15:01:42 +0000 (15:01 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 10 Mar 2026 15:01:42 +0000 (15:01 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/dbl/api/reports.py
src/dbl/reports.py

index b7d5d670b25b618c852fdf6613b7637b702a12cb..29db37ce363cb2b6f6128e1859cf8f6f9b347d8a 100644 (file)
@@ -47,6 +47,9 @@ class CreateReport(pydantic.BaseModel):
        # Block?
        block: bool = True
 
+       # Notify
+       notify: bool = True
+
 
 class CloseReport(pydantic.BaseModel):
        # Accept?
@@ -124,6 +127,7 @@ async def create_report(
                reported_by = user,
                comment     = report.comment,
                block       = report.block,
+               notify      = report.notify,
        )
 
 @router.get("/{id}")
index b48d7d40fad50661850c61b7c92f645f596daf27..474a6d3cfec51b3d4d8da6ece5f24f693c1e2eed 100644 (file)
@@ -119,7 +119,7 @@ class Reports(object):
 
                return self.backend.db.fetch(stmt)
 
-       async def create(self, name, reported_by, comment=None, **kwargs):
+       async def create(self, name, reported_by, comment=None, notify=True, **kwargs):
                """
                        Creates a new report
                """
@@ -145,7 +145,8 @@ class Reports(object):
                        )
 
                # Send a notification to the reporter
-               await report._send_opening_notification()
+               if notify:
+                       await report._send_opening_notification()
 
                return report