Add support for threads (#216)

This commit is contained in:
Ulyssa 2024-03-09 00:47:05 -08:00 committed by GitHub
parent 8ee203c9a9
commit ef868175cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 466 additions and 201 deletions

View file

@ -409,7 +409,7 @@ fn members_insert(
) {
if let Ok(members) = res {
let ChatStore { rooms, .. } = &mut store.application;
let info = rooms.get_or_default(room_id.clone());
let info = rooms.get_or_default(room_id);
for member in members {
let user_id = member.user_id();
@ -1069,12 +1069,20 @@ impl ClientWorker {
match info.keys.get(redacts) {
None => return,
Some(EventLocation::Message(key)) => {
Some(EventLocation::Message(None, key)) => {
if let Some(msg) = info.messages.get_mut(key) {
let ev = SyncRoomRedactionEvent::Original(ev);
msg.redact(ev, room_version);
}
},
Some(EventLocation::Message(Some(root), key)) => {
if let Some(thread) = info.threads.get_mut(root) {
if let Some(msg) = thread.get_mut(key) {
let ev = SyncRoomRedactionEvent::Original(ev);
msg.redact(ev, room_version);
}
}
},
Some(EventLocation::Reaction(event_id)) => {
if let Some(reactions) = info.reactions.get_mut(event_id) {
reactions.remove(redacts);