diff --git a/backend/api/consumers.py b/backend/api/consumers.py index d619c875..7633b3cb 100644 --- a/backend/api/consumers.py +++ b/backend/api/consumers.py @@ -46,6 +46,8 @@ def bis(self, event): 'reloadUrls': [ f'/characters/{event["char"]}/', f'/characters/{event["char"]}/bis_list/{event["id"]}/', + '/team/join/', + '/team/new/', ], } self.send(text_data=json.dumps(payload)) @@ -56,7 +58,11 @@ def character(self, event): """ payload = { 'model': 'character', - 'reloadUrls': [f'/characters/{event["id"]}/'], + 'reloadUrls': [ + f'/characters/{event["id"]}/', + '/team/join/', + '/team/new/', + ], } self.send(text_data=json.dumps(payload)) @@ -96,6 +102,9 @@ def team(self, event): """ payload = { 'model': 'team', - 'reloadUrls': [f'/team/{event["id"]}/'], + 'reloadUrls': [ + f'/team/{event["id"]}/', + f'/team/join/{event["invite_code"]}/', + ], } self.send(text_data=json.dumps(payload)) diff --git a/backend/api/views/bis_list.py b/backend/api/views/bis_list.py index d48442c4..0931f2b4 100644 --- a/backend/api/views/bis_list.py +++ b/backend/api/views/bis_list.py @@ -103,7 +103,10 @@ def put(self, request: Request, character_id: int, pk: int) -> Response: # Send a WS updates for BIS and Teams self._send_to_user(char.user, {'type': 'bis', 'char': char.id, 'id': serializer.instance.pk}) for tm in obj.teammember_set.all(): - self._send_to_team(tm.team, {'type': 'team', 'id': str(tm.team.id)}) + self._send_to_team( + tm.team, + {'type': 'team', 'id': str(tm.team.id), 'invite_code': str(tm.team.invite_code)}, + ) # Sync lists, if any requested self._sync_lists(serializer.instance, request.GET.getlist('sync')) diff --git a/backend/api/views/character.py b/backend/api/views/character.py index 38998e1c..ff21eb4d 100644 --- a/backend/api/views/character.py +++ b/backend/api/views/character.py @@ -85,7 +85,10 @@ def put(self, request: Request, pk: int) -> Response: # Send WS updates self._send_to_user(request.user, {'type': 'character', 'id': obj.id}) for tm in obj.teammember_set.all(): - self._send_to_team(tm.team, {'type': 'team', 'id': str(tm.team.id)}) + self._send_to_team( + tm.team, + {'type': 'team', 'id': str(tm.team.id), 'invite_code': str(tm.team.invite_code)}, + ) return Response(status=204) @@ -158,7 +161,10 @@ def delete(self, request: Request, pk: int) -> Response: # Send WS updates self._send_to_user(request.user, {'type': 'character', 'id': char_id}) for tm in teams: - self._send_to_team(tm.team, {'type': 'team', 'id': str(tm.team.id)}) + self._send_to_team( + tm.team, + {'type': 'team', 'id': str(tm.team.id), 'invite_code': str(tm.team.invite_code)}, + ) # Potential need to clean up here, but I don't feel like it's too big of an issue return Response(status=204) diff --git a/backend/api/views/team.py b/backend/api/views/team.py index dac22213..eeb33af8 100644 --- a/backend/api/views/team.py +++ b/backend/api/views/team.py @@ -69,7 +69,7 @@ def post(self, request: Request) -> Response: ) # Websocket stuff - self._send_to_user(request.user, {'type': 'team', 'id': str(obj.id)}) + self._send_to_user(request.user, {'type': 'team', 'id': str(obj.id), 'invite_code': str(obj.invite_code)}) # With everything created, return the Team ID return Response({'id': obj.id}, status=201) @@ -116,7 +116,7 @@ def put(self, request: Request, pk: str) -> Response: obj.make_lead(obj.members.get(pk=team_lead_id)) # Websocket stuff - self._send_to_team(obj, {'type': 'team', 'id': str(obj.id)}) + self._send_to_team(obj, {'type': 'team', 'id': str(obj.id), 'invite_code': str(obj.invite_code)}) for tm in obj.members.all(): self._send_to_user(tm.character.user, {'type': 'character', 'id': tm.character.pk}) return Response(status=204) @@ -149,7 +149,7 @@ def delete(self, request: Request, pk: str) -> Response: obj.disband() # Websocket stuff - self._send_to_team(obj, {'type': 'team', 'id': team_id}) + self._send_to_team(obj, {'type': 'team', 'id': team_id, 'invite_code': str(obj.invite_code)}) for tm in members: self._send_to_user(tm.character.user, {'type': 'character', 'id': tm.character.pk}) return Response(status=204) @@ -206,7 +206,7 @@ def post(self, request: Request, invite_code: str) -> Response: notifier.team_join(tm.character, obj) # Websocket stuff - self._send_to_team(obj, {'type': 'team', 'id': str(obj.id)}) + self._send_to_team(obj, {'type': 'team', 'id': str(obj.id), 'invite_code': str(obj.invite_code)}) for tm in obj.members.all(): self._send_to_user(tm.character.user, {'type': 'character', 'id': tm.character.pk}) diff --git a/backend/api/views/team_member.py b/backend/api/views/team_member.py index 3e378714..bf1c2ac3 100644 --- a/backend/api/views/team_member.py +++ b/backend/api/views/team_member.py @@ -55,7 +55,7 @@ def put(self, request: Request, team_id: str, pk: id) -> Response: obj.save() # Websocket stuff - self._send_to_team(obj.team, {'type': 'team', 'id': str(obj.team.id)}) + self._send_to_team(obj.team, {'type': 'team', 'id': str(obj.team.id), 'invite_code': str(obj.team.invite_code)}) for tm in obj.team.members.all(): self._send_to_user(tm.character.user, {'type': 'character', 'id': tm.character.pk}) @@ -106,7 +106,7 @@ 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)}) + 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_user(tm.character.user, {'type': 'character', 'id': tm.character.pk}) @@ -148,7 +148,7 @@ def put(self, request: Request, team_id: str, pk: id) -> Response: obj.save() # Websocket stuff - self._send_to_team(obj.team, {'type': 'team', 'id': str(obj.team.id)}) + self._send_to_team(obj.team, {'type': 'team', 'id': str(obj.team.id), 'invite_code': str(obj.team.invite_code)}) for tm in obj.team.members.all(): self._send_to_user(tm.character.user, {'type': 'character', 'id': tm.character.pk}) diff --git a/backend/api/views/team_proxy.py b/backend/api/views/team_proxy.py index abed87c2..a0491594 100644 --- a/backend/api/views/team_proxy.py +++ b/backend/api/views/team_proxy.py @@ -57,7 +57,7 @@ def post(self, request: Request, team_id: str) -> Response: team.members.create(character=char_serializer.instance, bis_list=bis_serializer.instance) # Websocket stuff - self._send_to_team(team, {'type': 'team', 'id': str(team.id)}) + 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_user(tm.character.user, {'type': 'character', 'id': tm.character.pk}) @@ -111,7 +111,7 @@ def put(self, request: Request, team_id: str, pk: int) -> Response: # Send a WS updates for BIS and Teams self._send_to_user(obj.character.user, {'type': 'bis', 'char': obj.character.id, 'id': serializer.instance.pk}) for tm in team.members.all(): - self._send_to_team(team, {'type': 'team', 'id': str(tm.team.id)}) + self._send_to_team(team, {'type': 'team', 'id': str(team.id), 'invite_code': str(team.invite_code)}) return Response(status=204) diff --git a/frontend/src/components/modals/changelog.vue b/frontend/src/components/modals/changelog.vue index dd8cfe99..8a4d42a8 100644 --- a/frontend/src/components/modals/changelog.vue +++ b/frontend/src/components/modals/changelog.vue @@ -62,6 +62,7 @@
Fixed issue where certain parts of the Edit Proxy page were not displaying information correctly.
+Team Create and Join pages now have special handling for when the user has no Characters yet.
diff --git a/frontend/src/components/team/member_manager.vue b/frontend/src/components/team/member_manager.vue index 54e08a86..81f6acee 100644 --- a/frontend/src/components/team/member_manager.vue +++ b/frontend/src/components/team/member_manager.vue @@ -40,17 +40,20 @@ import TeamMember from '@/interfaces/team_member' @Component export default class TeamMemberManager extends Vue { @Prop() - userIsLead!: boolean + member!: TeamMember @Prop() - member!: TeamMember + teamId!: string + + @Prop() + userIsLead!: boolean editPermissions(): void { - this.$modal.show(Permissions, { member: this.member, teamId: this.$route.params.id }, { }, { closed: () => { this.$emit('reload') } }) + this.$modal.show(Permissions, { member: this.member, teamId: this.teamId }, { }, { closed: () => { this.$emit('reload') } }) } kick(): void { - this.$modal.show(KickFromTeam, { details: this.member, teamId: this.$route.params.id }, { }, { closed: () => { this.$emit('reload') } }) + this.$modal.show(KickFromTeam, { details: this.member, teamId: this.teamId }, { }, { closed: () => { this.$emit('reload') } }) } } diff --git a/frontend/src/components/team/proxy_manager.vue b/frontend/src/components/team/proxy_manager.vue index 3f42aeca..e2585451 100644 --- a/frontend/src/components/team/proxy_manager.vue +++ b/frontend/src/components/team/proxy_manager.vue @@ -42,11 +42,14 @@ export default class ProxyMemberManager extends Vue { @Prop() member!: TeamMember + @Prop() + teamId!: string + @Prop() userHasPermission!: boolean kick(): void { - this.$modal.show(KickFromTeam, { details: this.member, teamId: this.$route.params.id }, { }, { closed: () => { this.$emit('reload') } }) + this.$modal.show(KickFromTeam, { details: this.member, teamId: this.teamId }, { }, { closed: () => { this.$emit('reload') } }) } } diff --git a/frontend/src/views/team/create.vue b/frontend/src/views/team/create.vue index 88f9b801..54f732fa 100644 --- a/frontend/src/views/team/create.vue +++ b/frontend/src/views/team/create.vue @@ -20,18 +20,31 @@{{ errors.tier_id[0] }}
+ +{{ errors.tier_id[0] }}
++ Your account currently has no Characters. You have two choices as to how you proceed; +