Skip to content

Commit

Permalink
Close invitations of players that left or got kicked
Browse files Browse the repository at this point in the history
  • Loading branch information
myOmikron committed May 13, 2023
1 parent a5a1050 commit 3b0e54c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/server/handler/lobbies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use uuid::Uuid;
use crate::chan::{WsManagerChan, WsManagerMessage, WsMessage};
use crate::models::{
Account, ChatRoomInsert, ChatRoomMember, ChatRoomMemberInsert, ChatRoomMessage,
GameAccountInsert, GameInsert, Lobby, LobbyAccount, LobbyAccountInsert, LobbyInsert,
GameAccountInsert, GameInsert, Invite, Lobby, LobbyAccount, LobbyAccountInsert, LobbyInsert,
};
use crate::server::handler::{AccountResponse, ApiError, ApiResult, PathUuid};

Expand Down Expand Up @@ -888,6 +888,11 @@ pub async fn leave_lobby(
))
.await?;

// Delete all invites of this player
rorm::delete!(&mut tx, Invite)
.condition(Invite::F.from.equals(uuid.as_ref()))
.await?;

let (uuid, username, display_name) = query!(
&mut tx,
(
Expand Down Expand Up @@ -1008,6 +1013,11 @@ pub async fn kick_player_from_lobby(
))
.await?;

// Delete all invites of this player
rorm::delete!(&mut tx, Invite)
.condition(Invite::F.from.equals(path.player_uuid.as_ref()))
.await?;

let (uuid, username, display_name) = query!(
&mut tx,
(
Expand Down

0 comments on commit 3b0e54c

Please sign in to comment.