profiles: friend and block through profile page :))

This commit is contained in:
AdrienLSH
2024-04-22 18:05:09 +02:00
parent 2a63edf739
commit 8c8847cdd8
5 changed files with 175 additions and 147 deletions

View File

@ -50,16 +50,16 @@ class EditFriendView(APIView):
user_profile = self.get_object()
friend_profile = get_object_or_404(ProfileModel, pk=pk)
if not user_profile.is_friend(friend_profile):
return Response(_('You are not friend with this user.'), status.HTTP_400_BAD_REQUEST)
outgoing_request = user_profile.get_outgoing_friend_request_to(friend_profile)
if outgoing_request:
outgoing_request.delete()
return Response(_('Friend request cancelled.'))
if not user_profile.is_friend(friend_profile):
return Response(_('You are not friend with this user.'), status.HTTP_400_BAD_REQUEST)
user_profile.delete_friend(friend_profile)
return Response(_('Friendship succssfully deleted.'))
return Response(_('Friendship succssfully deleted.'), status.HTTP_201_CREATED)
class GetIncomingFriendRequestView(APIView):