diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-11-18 11:23:52 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-11-18 11:23:52 +0100 |
commit | e7f82bda1534880bf4c6695b9f074241dfc56ac3 (patch) | |
tree | 1ff65b9e88de18c7193a4ee6c13386f1561003d6 | |
parent | 0722d176e4688e44f5572eefb29a6d6c4bb131fc (diff) |
Matrix: fix read marker if the last message is a redact or edit
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | src/QuickMedia.cpp | 7 |
2 files changed, 7 insertions, 1 deletions
@@ -125,7 +125,6 @@ Implement m.room.tombstone. Show a marker when a room uses encryption. Remove replied-to message text in room preview. That shows ignored users text and we want to see the reply message instead anyways. Update room name/avatar with new data in /sync. -Read marker is incorrect if the last message is an edit/redact, because they are hidden and replaces other body items instead. Scroll tabs if there are more than 3 tab items and show arrow on left/right side when there are more items to see. Make a shader for Text for changing color instead of updating the text geometry. Or loop vertices and set their color to the new color without updating the text geometry. Automatically retry sending messages that fails to send (after timeout). These failed to send messages should be stored on disk and retried when going back to the room or restarting QuickMedia. diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 7cface4..20c2371 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -3516,6 +3516,11 @@ namespace QuickMedia { auto body_item_shared_ptr = tabs[MESSAGES_TAB_INDEX].body->items[body_item_index]; body_item_shared_ptr->set_description(text); body_item_shared_ptr->set_description_color(provisional_message_color); + + auto edit_body_item = message_to_body_item(current_room, message.get(), current_room->get_user_avatar_url(me), me->user_id); + edit_body_item->visible = false; + tabs[MESSAGES_TAB_INDEX].body->insert_items_by_timestamps({edit_body_item}); + //unreferenced_events.push_back(message); post_task_queue.push([this, ¤t_room, text, related_to_message, message, body_item_shared_ptr]() { ProvisionalMessage provisional_message; @@ -4549,6 +4554,8 @@ namespace QuickMedia { if(selected_tab == MESSAGES_TAB_INDEX && current_room && matrix->is_initial_sync_finished()) { BodyItem *last_visible_item = tabs[selected_tab].body->get_last_fully_visible_item(); + if(last_visible_item && tabs[selected_tab].body->is_last_item_fully_visible() && !tabs[selected_tab].body->items.empty()) + last_visible_item = tabs[selected_tab].body->items.back().get(); if(is_window_focused && chat_state != ChatState::URL_SELECTION && current_room && last_visible_item && !setting_read_marker && read_marker_timer.getElapsedTime().asMilliseconds() >= read_marker_timeout_ms) { Message *message = (Message*)last_visible_item->userdata; // TODO: What if two messages have the same timestamp? |