From 79a575beddfd23dd3103fdb41a9c5b176ee321f3 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 3 Nov 2020 04:27:06 +0100 Subject: Matrix: attach messages to bottom for initial fetch to reduce jumping of body items --- src/plugins/Matrix.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/plugins/Matrix.cpp') diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 5a85e8e..96ce789 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -376,7 +376,7 @@ namespace QuickMedia { // TODO: Binary search? Message *last_unread_message = nullptr; for(auto it = messages.rbegin(), end = messages.rend(); it != end; ++it) { - if((*it)->related_event_type != RelatedEventType::EDIT && (*it)->related_event_type != RelatedEventType::REDACTION && (*it)->timestamp > read_marker_message_timestamp) { + if((*it)->timestamp > read_marker_message_timestamp) { last_unread_message = (*it).get(); break; } @@ -400,13 +400,7 @@ namespace QuickMedia { room_tags_page->move_room_to_top(room); } else if(is_initial_sync) { Message *last_message = nullptr; - for(auto it = messages.rbegin(), end = messages.rend(); it != end; ++it) { - if((*it)->related_event_type != RelatedEventType::EDIT && (*it)->related_event_type != RelatedEventType::REDACTION) { - last_message = (*it).get(); - break; - } - } - if(last_message && !messages.empty()) + if(!messages.empty()) last_message = messages.back().get(); if(last_message) room_body_item->set_description(matrix->message_get_author_displayname(last_message) + ": " + extract_first_line_elipses(last_message->body, 150)); @@ -3104,6 +3098,7 @@ namespace QuickMedia { return nullptr; } + // Is this a synapse bug? sometimes lazy_fetch_members doesn't contain all related clients fprintf(stderr, "User was not available locally, fetched from server...\n"); return parse_user_info(json_root, user_id, room); } -- cgit v1.2.3