1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-12-22 06:44:21 +00:00

🐛 POST and DELETE should be idempotent

This commit is contained in:
Steffo 2021-10-29 01:07:48 +02:00
parent 7074b3f921
commit 363d1568b1

View file

@ -262,10 +262,6 @@ class ResearchGroupViewSet(WriteSophonViewSet):
"""
group = models.ResearchGroup.objects.get(pk=pk)
# Raise an error if the user is already in the group
if self.request.user in group.members.all():
return Response(status=s.HTTP_409_CONFLICT)
# Raise an error if the group doesn't allow member joins
if group.access != "OPEN":
return Response(status=s.HTTP_403_FORBIDDEN)
@ -287,10 +283,6 @@ class ResearchGroupViewSet(WriteSophonViewSet):
"""
group = models.ResearchGroup.objects.get(pk=pk)
# Raise an error if the user is not in the group
if self.request.user not in group.members.all():
return Response(status=s.HTTP_409_CONFLICT)
# Raise an error if the user is the owner of the group
if self.request.user == group.owner:
return Response(status=s.HTTP_403_FORBIDDEN)