Avoid adding a user to a chat channel more than once

This commit is contained in:
NG (Graham) committed 2026-01-04 17:22:11 -05:00
1 parent 09c1d2b344
commit 8a759c74c9
1 file changed
+5 -1
+5 -1
View File
@@ -79,7 +79,11 @@ impl ChatRoom {
channel: crate::events::room_join::RoomJoined::CHANNEL,
reliable: true,
});
self.online_users.push(handle);
if !self.online_users.iter().any(|other| other.name() == handle.name()) {
self.online_users.push(handle);
} else {
log::warn!("User {} tried to join channel {} again", handle.name(), self.name);
}
}
pub fn remove_user(&mut self, name: &str) -> bool {