aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp13
-rw-r--r--src/plugins/Matrix.cpp11
2 files changed, 12 insertions, 12 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index fe2e7b0..7d7e97f 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -3427,6 +3427,8 @@ namespace QuickMedia {
sf::Vertex gradient_points[4];
double gradient_inc = 0;
+ tabs[MESSAGES_TAB_INDEX].body->set_page_scroll(window_size.y);
+
bool initial_prev_messages_fetch = false;
if(num_messages_in_room < 10 && matrix->is_initial_sync_finished()) {
initial_prev_messages_fetch = true;
@@ -3993,7 +3995,9 @@ namespace QuickMedia {
if(previous_messages_future.ready()) {
Messages new_messages = previous_messages_future.get();
fprintf(stderr, "Finished fetching older messages, num new messages: %zu\n", new_messages.size());
- // Ignore finished fetch of messages if it happened in another room. When we navigate back to the room we will get the messages again
+ bool move_to_bottom = false;
+ if(initial_prev_messages_fetch)
+ move_to_bottom = tabs[MESSAGES_TAB_INDEX].body->no_items_visible();
size_t num_new_messages = new_messages.size();
if(num_new_messages > 0) {
BodyItem *selected_item = tabs[MESSAGES_TAB_INDEX].body->get_selected();
@@ -4011,9 +4015,10 @@ namespace QuickMedia {
if(initial_prev_messages_fetch) {
initial_prev_messages_fetch = false;
// XXX: Hack to scroll up while keeping the selected item (usually the last one) visible
- int selected_item = tabs[MESSAGES_TAB_INDEX].body->get_selected_item();
- tabs[MESSAGES_TAB_INDEX].body->select_first_item();
- tabs[MESSAGES_TAB_INDEX].body->set_selected_item(selected_item, false);
+ if(move_to_bottom) {
+ tabs[MESSAGES_TAB_INDEX].body->select_last_item();
+ tabs[MESSAGES_TAB_INDEX].body->set_page_scroll(window_size.y);
+ }
}
}
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);
}