From aaf746ffdd3e0fc402905359ee5ccac63cb1af4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Kub=C3=ADk?= Date: Wed, 20 Dec 2023 13:34:45 +0100 Subject: [PATCH] fix(sync): correctly update presence properties --- src/api/client_server/sync.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/api/client_server/sync.rs b/src/api/client_server/sync.rs index b9878c6c..cac2d7f3 100644 --- a/src/api/client_server/sync.rs +++ b/src/api/client_server/sync.rs @@ -594,17 +594,15 @@ async fn process_room_presence_updates( // Update existing presence event with more info curr_content.presence = new_content.presence; - curr_content.status_msg = - curr_content.status_msg.clone().or(new_content.status_msg); + curr_content.status_msg = new_content.status_msg.or(curr_content.status_msg.take()); curr_content.last_active_ago = - curr_content.last_active_ago.or(new_content.last_active_ago); + new_content.last_active_ago.or(curr_content.last_active_ago); curr_content.displayname = - curr_content.displayname.clone().or(new_content.displayname); - curr_content.avatar_url = - curr_content.avatar_url.clone().or(new_content.avatar_url); - curr_content.currently_active = curr_content + new_content.displayname.or(curr_content.displayname.take()); + curr_content.avatar_url = new_content.avatar_url.or(curr_content.avatar_url.take()); + curr_content.currently_active = new_content .currently_active - .or(new_content.currently_active); + .or(curr_content.currently_active); } } }