From dcaa96a79f7b1480b17e875025341007eba8455d Mon Sep 17 00:00:00 2001 From: strawberry Date: Thu, 25 Jul 2024 23:06:14 -0400 Subject: [PATCH] sync: always include_redundant_members when using element_hacks feature see: - https://github.com/matrix-org/matrix-js-sdk/pull/4329 - https://github.com/element-hq/synapse/blob/568051c0f07393b786b9d813a1db53dd332c9fc2/synapse/handlers/pagination.py#L639 - https://matrix.to/#/!n8DKU1BeeJilOJXDPr:seirdy.one/$gvGF7GuPrLPR8nHg4UiHvP-ZVwuiMkYS8O6VlsDCW9w?via=awawawawawawawawawawawawawawawawawawawawawawawawawawawawawawaw.gay&via=transfem.dev&via=matrix.org Signed-off-by: strawberry --- src/api/client/context.rs | 4 +++- src/api/client/sync.rs | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/api/client/context.rs b/src/api/client/context.rs index 89a08153..f223d488 100644 --- a/src/api/client/context.rs +++ b/src/api/client/context.rs @@ -21,11 +21,13 @@ pub(crate) async fn get_context_route( let sender_user = body.sender_user.as_ref().expect("user is authenticated"); let sender_device = body.sender_device.as_ref().expect("user is authenticated"); + // some clients, at least element, seem to require knowledge of redundant + // members for "inline" profiles on the timeline to work properly let (lazy_load_enabled, lazy_load_send_redundant) = match &body.filter.lazy_load_options { LazyLoadOptions::Enabled { include_redundant_members, } => (true, *include_redundant_members), - LazyLoadOptions::Disabled => (false, false), + LazyLoadOptions::Disabled => (false, cfg!(feature = "element_hacks")), }; let mut lazy_loaded = HashSet::new(); diff --git a/src/api/client/sync.rs b/src/api/client/sync.rs index 34baf7c1..b25348d4 100644 --- a/src/api/client/sync.rs +++ b/src/api/client/sync.rs @@ -106,11 +106,13 @@ pub(crate) async fn sync_events_route( .unwrap_or_default(), }; + // some clients, at least element, seem to require knowledge of redundant + // members for "inline" profiles on the timeline to work properly let (lazy_load_enabled, lazy_load_send_redundant) = match filter.room.state.lazy_load_options { LazyLoadOptions::Enabled { - include_redundant_members: redundant, - } => (true, redundant), - LazyLoadOptions::Disabled => (false, false), + include_redundant_members, + } => (true, include_redundant_members), + LazyLoadOptions::Disabled => (false, cfg!(feature = "element_hacks")), }; let full_state = body.full_state;