forked from lavina/lavina
1
0
Fork 0

fix some stuff

This commit is contained in:
Nikita Vilunov 2023-02-14 23:43:59 +01:00
parent 3950ee1d7a
commit 7dfe6e0295
2 changed files with 5 additions and 17 deletions

View File

@ -294,17 +294,13 @@ impl Player {
room.subscribe(self.player_id.clone(), self.handle.clone())
.await;
self.my_rooms.insert(room_id.clone(), room.clone());
let members = room.get_members().await;
promise.send(RoomInfo {
id: room_id.clone(),
members,
topic: b"some topic lol".to_vec(),
});
let room_info = room.get_room_info().await;
promise.send(room_info);
let update = Updates::RoomJoined {
room_id,
new_member_id: self.player_id.clone(),
};
self.broadcast_update(update, connection_id);
self.broadcast_update(update, connection_id).await;
}
Cmd::SendMessage {
room_id,
@ -324,7 +320,7 @@ impl Player {
author_id: self.player_id.clone(),
body,
};
self.broadcast_update(update, connection_id);
self.broadcast_update(update, connection_id).await;
}
Cmd::ChangeTopic {
room_id,
@ -340,7 +336,7 @@ impl Player {
}
promise.send(());
let update = Updates::RoomTopicChanged { room_id, new_topic };
self.broadcast_update(update, connection_id);
self.broadcast_update(update, connection_id).await;
}
}
}

View File

@ -90,14 +90,6 @@ impl RoomHandle {
lock.send_message(player_id, body).await;
}
pub async fn get_members(&self) -> Vec<PlayerId> {
let lock = self.0.read().await;
lock.subscriptions
.keys()
.map(|x| x.clone())
.collect::<Vec<_>>()
}
pub async fn get_room_info(&self) -> RoomInfo {
let lock = self.0.read().await;
RoomInfo {