@@ -16,7 +16,7 @@ use matrix_sdk::{
16
16
} , sliding_sync:: VersionBuilder , Client , ClientBuildError , Error , OwnedServerName , Room , RoomMemberships , RoomState
17
17
} ;
18
18
use 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
20
20
} ;
21
21
use robius_open:: Uri ;
22
22
use tokio:: {
@@ -30,7 +30,7 @@ use std::io;
30
30
use ruma:: { api:: client:: { filter:: RoomEventFilter , search:: search_events:: v3:: { Criteria , EventContext , OrderBy , Request } } , events:: AnyTimelineEvent , uint} ;
31
31
use crate :: {
32
32
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 }
34
34
} , login:: login_screen:: LoginAction , media_cache:: { MediaCacheEntry , MediaCacheEntryRef } , persistent_state:: { self , ClientSessionPersisted } , profile:: {
35
35
user_profile:: { AvatarState , UserProfile } ,
36
36
user_profile_cache:: { enqueue_user_profile_update, UserProfileUpdate } ,
@@ -382,7 +382,7 @@ pub enum MatrixRequest {
382
382
matrix_id : MatrixId ,
383
383
via : Vec < OwnedServerName >
384
384
} ,
385
- /// General Matrix Search API with given categorie
385
+ /// General Matrix Search API with given categories
386
386
SearchMessages {
387
387
/// The room to search for message.
388
388
room_id : OwnedRoomId ,
@@ -838,7 +838,7 @@ async fn async_worker(
838
838
839
839
let _typing_notices_task = Handle :: current ( ) . spawn ( async move {
840
840
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:?}");
842
842
let mut users = Vec :: with_capacity ( user_ids. len ( ) ) ;
843
843
for user_id in user_ids {
844
844
users. push (
@@ -1148,8 +1148,16 @@ async fn async_worker(
1148
1148
let mut last_room_id = None ;
1149
1149
let result = response. search_categories ;
1150
1150
let mut items = vec ! [ ] ;
1151
+ let mut profile_infos = BTreeMap :: new ( ) ;
1151
1152
for item in result. room_events . results . iter ( ) {
1152
1153
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
+ }
1153
1161
item. context . events_after . iter ( ) . rev ( ) . for_each ( |f| {
1154
1162
if let Ok ( timeline_event) = f. deserialize ( ) {
1155
1163
items. push ( SearchTimelineItem :: ContextEvent ( timeline_event) ) ;
@@ -1181,7 +1189,6 @@ async fn async_worker(
1181
1189
if last_room_id != & room_id {
1182
1190
* last_room_id = room_id. clone ( ) ;
1183
1191
items. push ( SearchTimelineItem :: RoomHeader ( room_id) ) ;
1184
-
1185
1192
}
1186
1193
} else {
1187
1194
last_room_id = Some ( room_id. clone ( ) ) ;
@@ -1191,7 +1198,7 @@ async fn async_worker(
1191
1198
}
1192
1199
let count = result. room_events . count . and_then ( |f| f. to_string ( ) . parse ( ) . ok ( ) ) . unwrap_or ( 0 ) ;
1193
1200
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 } ) {
1195
1202
error ! ( "Failed to search message in {room_id}; error: {e:?}" ) ;
1196
1203
enqueue_popup_notification ( format ! ( "Failed to search message. Error: {e}" ) ) ;
1197
1204
}
@@ -2865,6 +2872,8 @@ fn register_core_task(
2865
2872
2866
2873
async fn abort_core_task ( core_task : CoreTask ) {
2867
2874
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
+ }
2869
2878
}
2870
2879
}
0 commit comments