(backend) add unresolve action to ThreadViewSet

We have now the possibility to unresolve a thread
from the frontend.
We need to add the unresolve action to the
ThreadViewSet.
This commit is contained in:
Anthony LC
2026-05-26 12:21:47 +02:00
committed by Manuel Raynaud
parent 7956540b73
commit 7ad9550f54
6 changed files with 105 additions and 40 deletions
+11
View File
@@ -2972,6 +2972,17 @@ class ThreadViewSet(
thread.save(update_fields=["resolved", "resolved_at", "resolved_by"])
return drf.response.Response(status=status.HTTP_204_NO_CONTENT)
@drf.decorators.action(detail=True, methods=["post"], url_path="unresolve")
def unresolve(self, request, *args, **kwargs):
"""Unresolve a thread."""
thread = self.get_object()
if thread.resolved:
thread.resolved = False
thread.resolved_at = None
thread.resolved_by = None
thread.save(update_fields=["resolved", "resolved_at", "resolved_by"])
return drf.response.Response(status=status.HTTP_204_NO_CONTENT)
class CommentViewSet(
CommentViewSetMixin,