Browse Source

fix: only show one typing event per user

merge-requests/66/merge
Timo Kösters 5 years ago
parent
commit
3fa31631b6
No known key found for this signature in database
GPG Key ID: 24DA7517711A2BA4
  1. 10
      src/database/rooms/edus.rs

10
src/database/rooms/edus.rs

@ -9,7 +9,7 @@ use ruma::{ @@ -9,7 +9,7 @@ use ruma::{
RoomId, UInt, UserId,
};
use std::{
collections::HashMap,
collections::{HashMap, HashSet},
convert::{TryFrom, TryInto},
mem,
};
@ -280,7 +280,7 @@ impl RoomEdus { @@ -280,7 +280,7 @@ impl RoomEdus {
let mut prefix = room_id.as_bytes().to_vec();
prefix.push(0xff);
let mut user_ids = Vec::new();
let mut user_ids = HashSet::new();
for user_id in self
.typingid_userid
@ -295,11 +295,13 @@ impl RoomEdus { @@ -295,11 +295,13 @@ impl RoomEdus {
)
})
{
user_ids.push(user_id?);
user_ids.insert(user_id?);
}
Ok(SyncEphemeralRoomEvent {
content: ruma::events::typing::TypingEventContent { user_ids },
content: ruma::events::typing::TypingEventContent {
user_ids: user_ids.into_iter().collect(),
},
})
}

Loading…
Cancel
Save