From c7f7e4e36ea76e12c190c42d371c49b0a1871115 Mon Sep 17 00:00:00 2001 From: freyamade Date: Tue, 22 Oct 2024 17:26:53 +0200 Subject: [PATCH] fix 4.2 issue in one view --- backend/api/views/team_member.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/backend/api/views/team_member.py b/backend/api/views/team_member.py index 0975258..ba8ddac 100644 --- a/backend/api/views/team_member.py +++ b/backend/api/views/team_member.py @@ -101,8 +101,6 @@ def delete(self, request: Request, team_id: str, pk: id) -> Response: except (TeamMember.DoesNotExist, ValidationError): return Response(status=404) - team = obj.team - # Check permissions and kick status - Request is valid if; # - Anyone with the Proxy Manager permission is kicking a proxy # - The Team Leader is kicking someone *else* from the Team. @@ -136,8 +134,8 @@ def delete(self, request: Request, team_id: str, pk: id) -> Response: obj.team.remove_character(obj.character, kick) # Websocket stuff - self._send_to_team(team, {'type': 'team', 'id': str(team.id), 'invite_code': str(team.invite_code)}) - for tm in team.members.all(): + self._send_to_team(obj.team, {'type': 'team', 'id': str(obj.team.id), 'invite_code': str(obj.team.invite_code)}) + for tm in TeamMember.objects.filter(team_id=team_id).select_related('character', 'character__user'): self._send_to_user(tm.character.user, {'type': 'character', 'id': tm.character.pk}) # Special handling for Proxy characters, we should delete them here