aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-11-18 11:23:52 +0100
committerdec05eba <dec05eba@protonmail.com>2020-11-18 11:23:52 +0100
commite7f82bda1534880bf4c6695b9f074241dfc56ac3 (patch)
tree1ff65b9e88de18c7193a4ee6c13386f1561003d6 /src
parent0722d176e4688e44f5572eefb29a6d6c4bb131fc (diff)
Matrix: fix read marker if the last message is a redact or edit
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp7
1 files changed, 7 insertions, 0 deletions
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, &current_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?