aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/api/viewsets
diff options
context:
space:
mode:
authorGravatar jchristgit <[email protected]>2023-12-11 16:33:16 +0100
committerGravatar GitHub <[email protected]>2023-12-11 15:33:16 +0000
commitf64174645de751075a00380c292b2eea96c687c4 (patch)
treec0d5cc5db41b9bc9c3364dc40a7023cd9e31e508 /pydis_site/apps/api/viewsets
parentMention READMEs for app dirs in contributing guide (#1168) (diff)
Implement editing of offensive message records (#1165)
Allow changing the deletion date of offensive message records in case the bot encounters an error during deletion attempts. Fixes #364. Unblocks python-discord/bot#1013.
Diffstat (limited to 'pydis_site/apps/api/viewsets')
-rw-r--r--pydis_site/apps/api/viewsets/bot/offensive_message.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/pydis_site/apps/api/viewsets/bot/offensive_message.py b/pydis_site/apps/api/viewsets/bot/offensive_message.py
index 54cb3a38..fc8837e0 100644
--- a/pydis_site/apps/api/viewsets/bot/offensive_message.py
+++ b/pydis_site/apps/api/viewsets/bot/offensive_message.py
@@ -1,6 +1,7 @@
from rest_framework.mixins import (
CreateModelMixin,
DestroyModelMixin,
+ UpdateModelMixin,
ListModelMixin
)
from rest_framework.viewsets import GenericViewSet
@@ -10,7 +11,7 @@ from pydis_site.apps.api.serializers import OffensiveMessageSerializer
class OffensiveMessageViewSet(
- CreateModelMixin, ListModelMixin, DestroyModelMixin, GenericViewSet
+ CreateModelMixin, ListModelMixin, UpdateModelMixin, DestroyModelMixin, GenericViewSet
):
"""
View providing CRUD access to offensive messages.
@@ -46,6 +47,16 @@ class OffensiveMessageViewSet(
- 201: returned on success
- 400: if the body format is invalid
+ ### PATCH /bot/offensive-messages/<id:int>
+ Perform a partial update of the offensive message with the given `id`.
+ Intended to allow rescheduling the deletion date in case the bot's attempt
+ to delete the message failed due to another error than the message already
+ being deleted.
+
+ #### Status codes
+ - 200: returned on success
+ - 404: if a offensive message object with the given `id` does not exist
+
### DELETE /bot/offensive-messages/<id:int>
Delete the offensive message object with the given `id`.