aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-11-17 00:47:43 +0100
committerdec05eba <dec05eba@protonmail.com>2020-11-17 00:47:43 +0100
commit516ea5d7855c89edc57a7822b72cfc716aed90ae (patch)
tree21cef0385d59523ac46bcde36b7f1f840ef341c7 /src
parent338694c827320467dc5bff124c25ff82603e51a6 (diff)
Matrix: fix message sorting for previous messages
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index d0eadb4..71ba8d2 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -4367,15 +4367,15 @@ namespace QuickMedia {
if(num_new_messages > 0) {
BodyItem *selected_item = tabs[MESSAGES_TAB_INDEX].body->get_selected();
BodyItems new_body_items = messages_to_body_items(current_room, new_messages, current_room->get_user_display_name(me), me->user_id);
- size_t num_new_body_items = new_body_items.size();
- tabs[MESSAGES_TAB_INDEX].body->prepend_items(std::move(new_body_items)); // TODO: Insert by timestamp? then make sure num_new_body_items matches the first items blabla
+ tabs[MESSAGES_TAB_INDEX].body->insert_items_by_timestamps(std::move(new_body_items));
if(selected_item) {
int selected_item_index = tabs[MESSAGES_TAB_INDEX].body->get_index_by_body_item(selected_item);
if(selected_item_index != -1)
tabs[MESSAGES_TAB_INDEX].body->set_selected_item(selected_item_index);
}
modify_related_messages_in_current_room(new_messages);
- resolve_unreferenced_events_with_body_items(tabs[MESSAGES_TAB_INDEX].body->items.data(), num_new_body_items);
+ // TODO: Do not loop all items, only loop the new items
+ resolve_unreferenced_events_with_body_items(tabs[MESSAGES_TAB_INDEX].body->items.data(), tabs[MESSAGES_TAB_INDEX].body->items.size());
}
if(initial_prev_messages_fetch) {
initial_prev_messages_fetch = false;