@@ -16,7 +16,7 @@ use matrix_sdk::{
1616 } , sliding_sync:: VersionBuilder , Client , ClientBuildError , Error , OwnedServerName , Room , RoomMemberships , RoomState
1717} ;
1818use matrix_sdk_ui:: {
19- room_list_service:: { self , RoomListLoadingState } , sync_service:: { self , SyncService } , timeline:: { AnyOtherFullStateEventContent , EventTimelineItem , MembershipChange , RepliedToInfo , TimelineEventItemId , TimelineItem , TimelineItemContent } , RoomListService , Timeline
19+ room_list_service:: { self , RoomListLoadingState } , sync_service:: { self , SyncService } , timeline:: { AnyOtherFullStateEventContent , EventTimelineItem , MembershipChange , RepliedToInfo , TimelineDetails , TimelineEventItemId , TimelineItem , TimelineItemContent } , RoomListService , Timeline
2020} ;
2121use robius_open:: Uri ;
2222use tokio:: {
@@ -30,7 +30,7 @@ use std::io;
3030use ruma:: { api:: client:: { filter:: RoomEventFilter , search:: search_events:: v3:: { Criteria , EventContext , OrderBy , Request } } , events:: AnyTimelineEvent , uint} ;
3131use crate :: {
3232 app_data_dir, avatar_cache:: AvatarUpdate , event_preview:: text_preview_of_timeline_item, home:: {
33- invite_screen:: { JoinRoomAction , LeaveRoomAction } , room_screen:: TimelineUpdate , room_search_result :: SearchTimelineItem , rooms_list:: { self , enqueue_rooms_list_update, InvitedRoomInfo , InviterInfo , JoinedRoomInfo , RoomPreviewAvatar , RoomsListUpdate }
33+ invite_screen:: { JoinRoomAction , LeaveRoomAction } , room_screen:: { TimelineUpdate , SearchTimelineItem } , rooms_list:: { self , enqueue_rooms_list_update, InvitedRoomInfo , InviterInfo , JoinedRoomInfo , RoomPreviewAvatar , RoomsListUpdate }
3434 } , login:: login_screen:: LoginAction , media_cache:: { MediaCacheEntry , MediaCacheEntryRef } , persistent_state:: { self , ClientSessionPersisted } , profile:: {
3535 user_profile:: { AvatarState , UserProfile } ,
3636 user_profile_cache:: { enqueue_user_profile_update, UserProfileUpdate } ,
@@ -382,7 +382,7 @@ pub enum MatrixRequest {
382382 matrix_id : MatrixId ,
383383 via : Vec < OwnedServerName >
384384 } ,
385- /// General Matrix Search API with given categorie
385+ /// General Matrix Search API with given categories
386386 SearchMessages {
387387 /// The room to search for message.
388388 room_id : OwnedRoomId ,
@@ -838,7 +838,7 @@ async fn async_worker(
838838
839839 let _typing_notices_task = Handle :: current ( ) . spawn ( async move {
840840 while let Ok ( user_ids) = typing_notice_receiver. recv ( ) . await {
841- log ! ( "Received typing notifications for room {room_id}: {user_ids:?}" ) ;
841+ // log!("Received typing notifications for room {room_id}: {user_ids:?}");
842842 let mut users = Vec :: with_capacity ( user_ids. len ( ) ) ;
843843 for user_id in user_ids {
844844 users. push (
@@ -1148,8 +1148,16 @@ async fn async_worker(
11481148 let mut last_room_id = None ;
11491149 let result = response. search_categories ;
11501150 let mut items = vec ! [ ] ;
1151+ let mut profile_infos = BTreeMap :: new ( ) ;
11511152 for item in result. room_events . results . iter ( ) {
11521153 let Some ( event) = item. result . as_ref ( ) . and_then ( |f|f. deserialize ( ) . ok ( ) ) else { continue } ;
1154+ for ( user_id, profile) in item. context . profile_info . iter ( ) {
1155+ profile_infos. entry ( user_id. clone ( ) ) . or_insert_with ( || TimelineDetails :: Ready ( matrix_sdk_ui:: timeline:: Profile {
1156+ display_name : profile. displayname . clone ( ) ,
1157+ display_name_ambiguous : false ,
1158+ avatar_url : profile. avatar_url . clone ( )
1159+ } ) ) ;
1160+ }
11531161 item. context . events_after . iter ( ) . rev ( ) . for_each ( |f| {
11541162 if let Ok ( timeline_event) = f. deserialize ( ) {
11551163 items. push ( SearchTimelineItem :: ContextEvent ( timeline_event) ) ;
@@ -1181,7 +1189,6 @@ async fn async_worker(
11811189 if last_room_id != & room_id {
11821190 * last_room_id = room_id. clone ( ) ;
11831191 items. push ( SearchTimelineItem :: RoomHeader ( room_id) ) ;
1184-
11851192 }
11861193 } else {
11871194 last_room_id = Some ( room_id. clone ( ) ) ;
@@ -1191,7 +1198,7 @@ async fn async_worker(
11911198 }
11921199 let count = result. room_events . count . and_then ( |f| f. to_string ( ) . parse ( ) . ok ( ) ) . unwrap_or ( 0 ) ;
11931200 let highlights = result. room_events . highlights ;
1194- if let Err ( e) = sender. send ( TimelineUpdate :: SearchResultReceived { items, count, highlights, search_term : search_term. clone ( ) } ) {
1201+ if let Err ( e) = sender. send ( TimelineUpdate :: SearchResultReceived { items, count, highlights, search_term : search_term. clone ( ) , profile_infos } ) {
11951202 error ! ( "Failed to search message in {room_id}; error: {e:?}" ) ;
11961203 enqueue_popup_notification ( format ! ( "Failed to search message. Error: {e}" ) ) ;
11971204 }
@@ -2865,6 +2872,8 @@ fn register_core_task(
28652872
28662873async fn abort_core_task ( core_task : CoreTask ) {
28672874 if let Ok ( mut tasks) = CORE_TASKS . lock ( ) {
2868- tasks. remove ( & core_task) ;
2875+ if let Some ( handle) = tasks. remove ( & core_task) {
2876+ handle. abort ( ) ;
2877+ }
28692878 }
28702879}
0 commit comments