]> git.ipfire.org Git - dbl.git/commitdiff
api: Allow to post a comment when closing the report
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 3 Mar 2026 11:32:55 +0000 (11:32 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 3 Mar 2026 11:32:55 +0000 (11:32 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/dbl/api/reports.py

index 0bcb2c2fc258968154956521978b9f913a3964f2..cc62350dccd66d40e6422bcd26b420f6a72445b1 100644 (file)
@@ -49,6 +49,9 @@ class CloseReport(pydantic.BaseModel):
        # Accept?
        accept: bool = True
 
+       # Comment (optional)
+       comment: str = ""
+
 
 class Comment(pydantic.BaseModel):
        # Comment
@@ -110,6 +113,13 @@ async def close_report(
        if not await report.has_perm(user, accept=data.accept):
                raise fastapi.HTTPError(403, "You don't have permission to change this report")
 
+       # Post the comment if one has been sent
+       if data.comment:
+               await report.comment(
+                       comment  = data.comment,
+                       reporter = user,
+               )
+
        # Close the report
        await report.close(
                closed_by = user,