diff --git a/crates/matrix-sdk-base/src/client.rs b/crates/matrix-sdk-base/src/client.rs index 5e0c3af13e7..563abbc81a5 100644 --- a/crates/matrix-sdk-base/src/client.rs +++ b/crates/matrix-sdk-base/src/client.rs @@ -1148,7 +1148,7 @@ impl BaseClient { ); let mut room_info = room.clone_info(); - room_info.mark_as_invited(); + room_info.mark_as_knocked(); room_info.mark_state_fully_synced(); self.handle_invited_state( diff --git a/crates/matrix-sdk-base/src/sliding_sync/mod.rs b/crates/matrix-sdk-base/src/sliding_sync/mod.rs index ffe15f9f7cd..1f97eb1f526 100644 --- a/crates/matrix-sdk-base/src/sliding_sync/mod.rs +++ b/crates/matrix-sdk-base/src/sliding_sync/mod.rs @@ -33,7 +33,7 @@ use ruma::{ AnySyncStateEvent, }, serde::Raw, - JsOption, OwnedRoomId, RoomId, UInt, + JsOption, OwnedRoomId, RoomId, UInt, UserId, }; use tracing::{debug, error, instrument, trace, warn}; @@ -171,6 +171,12 @@ impl BaseClient { let mut notifications = Default::default(); let mut rooms_account_data = extensions.account_data.rooms.clone(); + let user_id = self + .session_meta() + .expect("Sliding sync shouldn't run without an authenticated user.") + .user_id + .to_owned(); + for (room_id, response_room_data) in rooms { let (room_info, joined_room, left_room, invited_room, knocked_room) = self .process_sliding_sync_room( @@ -178,6 +184,7 @@ impl BaseClient { response_room_data, &mut rooms_account_data, &store, + &user_id, &account_data_processor, &mut changes, &mut room_info_notable_updates, @@ -349,6 +356,7 @@ impl BaseClient { room_data: &http::response::Room, rooms_account_data: &mut BTreeMap>>, store: &Store, + user_id: &UserId, account_data_processor: &AccountDataProcessor, changes: &mut StateChanges, room_info_notable_updates: &mut BTreeMap, @@ -421,6 +429,7 @@ impl BaseClient { room_data.as_ref(), &state_events, store, + user_id, room_id, room_info_notable_updates, ); @@ -560,14 +569,10 @@ impl BaseClient { room_data: &http::response::Room, state_events: &[AnySyncStateEvent], store: &Store, + user_id: &UserId, room_id: &RoomId, room_info_notable_updates: &mut BTreeMap, ) -> (Room, RoomInfo, Option, Option) { - let user_id = self - .session_meta() - .expect("Sliding sync shouldn't run without an authenticated user.") - .user_id - .to_owned(); if let Some(invite_state) = &room_data.invite_state { let room = store.get_or_create_room( room_id, @@ -581,7 +586,7 @@ impl BaseClient { let membership_event_content = invite_state.iter().find_map(|raw| { raw.deserialize().ok().iter().find_map(|e| { if let AnyStrippedStateEvent::RoomMember(membership_event) = e { - if membership_event.sender == user_id { + if membership_event.state_key == user_id { return Some(membership_event.content.clone()); } }