profiles: friend and block through profile page :))
This commit is contained in:
@ -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):
|
||||
|
Reference in New Issue
Block a user