From c2e89b939c8746d27bb3209f6d8bcc35d614ed77 Mon Sep 17 00:00:00 2001 From: strawberry Date: Sat, 23 Mar 2024 23:40:09 -0400 Subject: [PATCH] add element web search count hack (?) Signed-off-by: strawberry --- src/api/client_server/message.rs | 4 ++-- src/api/client_server/search.rs | 8 ++++++-- src/api/client_server/sync.rs | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/api/client_server/message.rs b/src/api/client_server/message.rs index 8c4219eb..d724e46a 100644 --- a/src/api/client_server/message.rs +++ b/src/api/client_server/message.rs @@ -193,7 +193,7 @@ pub async fn get_message_events_route( * https://github.com/vector-im/element-android/issues/3417 * https://github.com/vector-im/element-web/issues/21034 */ - if !cfg!(features = "element_hacks") + if !cfg!(feature = "element_hacks") && !services().rooms.lazy_loading.lazy_load_was_sent_before( sender_user, sender_device, @@ -237,7 +237,7 @@ pub async fn get_message_events_route( * https://github.com/vector-im/element-android/issues/3417 * https://github.com/vector-im/element-web/issues/21034 */ - if !cfg!(features = "element_hacks") + if !cfg!(feature = "element_hacks") && !services().rooms.lazy_loading.lazy_load_was_sent_before( sender_user, sender_device, diff --git a/src/api/client_server/search.rs b/src/api/client_server/search.rs index 3d8ab2b2..0bb03df7 100644 --- a/src/api/client_server/search.rs +++ b/src/api/client_server/search.rs @@ -106,8 +106,12 @@ pub async fn search_events_route(body: Ruma) -> Resu Ok(search_events::v3::Response::new(ResultCategories { room_events: ResultRoomEvents { - count: Some((results.len() as u32).into()), // TODO: set this to none. Element shouldn't depend on it - groups: BTreeMap::new(), // TODO + count: if cfg!(feature = "element_hacks") { + Some((results.len() as u32).into()) + } else { + None + }, // TODO: set this to none. Element shouldn't depend on it (strawberry: why not?) + groups: BTreeMap::new(), // TODO next_batch, results, state: BTreeMap::new(), // TODO diff --git a/src/api/client_server/sync.rs b/src/api/client_server/sync.rs index ca155d5a..f72da248 100644 --- a/src/api/client_server/sync.rs +++ b/src/api/client_server/sync.rs @@ -298,7 +298,7 @@ async fn sync_helper( || event_type != StateEventType::RoomMember || full_state // TODO: Delete the following line when this is resolved: https://github.com/vector-im/element-web/issues/22565 - || (cfg!(features = "element_hacks") && *sender_user == state_key) + || (cfg!(feature = "element_hacks") && *sender_user == state_key) { let Some(pdu) = services().rooms.timeline.get_pdu(&id)? else { error!("Pdu in state not found: {}", id); @@ -627,7 +627,7 @@ async fn load_joined_room( || full_state || timeline_users.contains(&state_key) // TODO: Delete the following line when this is resolved: https://github.com/vector-im/element-web/issues/22565 - || (cfg!(features = "element_hacks") && *sender_user == state_key) + || (cfg!(feature = "element_hacks") && *sender_user == state_key) { let pdu = match services().rooms.timeline.get_pdu(&id)? { Some(pdu) => pdu,