From f4c8b773778e17aaa8fdd024f9881b95913e80ba Mon Sep 17 00:00:00 2001 From: morguldir Date: Sat, 24 Aug 2024 07:33:07 +0200 Subject: [PATCH] syncv3: include the invite_state in the response --- src/api/client/sync.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/api/client/sync.rs b/src/api/client/sync.rs index 544fe8b6..0b1e557c 100644 --- a/src/api/client/sync.rs +++ b/src/api/client/sync.rs @@ -1145,7 +1145,7 @@ pub(crate) async fn sync_events_v4_route( let all_rooms = all_joined_rooms .iter() .cloned() - .chain(all_invited_rooms.iter().cloned()) + .chain(all_invited_rooms.clone()) .collect(); if body.extensions.to_device.enabled.unwrap_or(false) { @@ -1490,6 +1490,16 @@ pub(crate) async fn sync_events_v4_route( .map(|(_, pdu)| pdu.to_sync_room_event()) .collect(); + let invite_state = if all_invited_rooms.contains(room_id) { + services + .rooms + .state_cache + .invite_state(&sender_user, room_id) + .unwrap_or(None) + } else { + None + }; + let required_state = required_state_request .iter() .map(|state| { @@ -1570,7 +1580,7 @@ pub(crate) async fn sync_events_v4_route( }, initial: Some(roomsince == &0), is_dm: None, - invite_state: None, + invite_state, unread_notifications: UnreadNotificationsCount { highlight_count: Some( services