aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-09-26 20:29:02 +0200
committerdec05eba <dec05eba@protonmail.com>2020-09-26 20:29:02 +0200
commitb48700a3bfe5bb2da0aec7dc8ec16848f4a8181d (patch)
treec47834e975d85fd138d8ed21be957a3b3b25e6bf /src
parent511716ea4e7c9034fbc38f208db5041107f76ee7 (diff)
Matrix: Fix page scroll when adding new previous messages, temporary disabling grouping of messages
Diffstat (limited to 'src')
-rw-r--r--src/Body.cpp2
-rw-r--r--src/plugins/Matrix.cpp37
2 files changed, 14 insertions, 25 deletions
diff --git a/src/Body.cpp b/src/Body.cpp
index b6b1540..25a7bc3 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -146,7 +146,7 @@ namespace QuickMedia {
assert(item >= 0 && item < (int)items.size());
selected_item = item;
prev_selected_item = selected_item;
- page_scroll = 0.0f;
+ //page_scroll = 0.0f;
}
void Body::select_first_item() {
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index a28aedc..a38c063 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -160,32 +160,21 @@ namespace QuickMedia {
}
static void room_messages_to_body_items(RoomData *room_data, Message *messages, size_t num_messages, BodyItems &result_items) {
- // TODO: This prev_user_id should check previous message, otherwise if after a sync there is only 1 new message then it wont
- // merge with the previous message. But for that to work then also have to send existing body items to this function,
- // to get the body item to merge with
- size_t prev_user_id = -1;
for(size_t i = 0; i < num_messages; ++i) {
const UserInfo &user_info = room_data->user_info[messages[i].user_id];
- if(messages[i].user_id == prev_user_id && messages[i].url.empty()) {
- assert(!result_items.empty());
- result_items.back()->append_description("\n");
- result_items.back()->append_description(messages[i].body);
- } else {
- auto body_item = std::make_unique<BodyItem>("");
- body_item->set_author(user_info.display_name);
- body_item->set_description(messages[i].body);
- if(!messages[i].thumbnail_url.empty())
- body_item->thumbnail_url = messages[i].thumbnail_url;
- else if(!messages[i].url.empty())
- body_item->thumbnail_url = messages[i].url;
- else
- body_item->thumbnail_url = user_info.avatar_url;
- // TODO: Show image thumbnail inline instead of url to image
- body_item->url = messages[i].url;
- body_item->author_color = user_info.display_name_color;
- result_items.push_back(std::move(body_item));
- prev_user_id = messages[i].user_id;
- }
+ auto body_item = std::make_unique<BodyItem>("");
+ body_item->set_author(user_info.display_name);
+ body_item->set_description(messages[i].body);
+ if(!messages[i].thumbnail_url.empty())
+ body_item->thumbnail_url = messages[i].thumbnail_url;
+ else if(!messages[i].url.empty())
+ body_item->thumbnail_url = messages[i].url;
+ else
+ body_item->thumbnail_url = user_info.avatar_url;
+ // TODO: Show image thumbnail inline instead of url to image and showing it as the thumbnail of the body item
+ body_item->url = messages[i].url;
+ body_item->author_color = user_info.display_name_color;
+ result_items.push_back(std::move(body_item));
}
}