aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-01-09 05:02:27 +0100
committerdec05eba <dec05eba@protonmail.com>2021-01-09 05:02:27 +0100
commit8074309e58110bf6ea99ead65e6b1cca8ca0a40d (patch)
tree1442c77716928103a3fc33863e873f51d54f7e0b
parent4b32f66ecae33fb904884d650c68b6c256c7f8ea (diff)
Matrix: fix loading of new pinned messages
-rw-r--r--src/Body.cpp2
-rw-r--r--src/QuickMedia.cpp17
2 files changed, 9 insertions, 10 deletions
diff --git a/src/Body.cpp b/src/Body.cpp
index 157ed03..8eeee49 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -695,7 +695,7 @@ namespace QuickMedia {
item_thumbnail->referenced = true;
}
- if(body_item_render_callback)
+ if(body_item_render_callback && include_embedded_item)
body_item_render_callback(item);
sf::Vector2f item_pos;
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 1a62fba..4cf4b09 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -3517,7 +3517,7 @@ namespace QuickMedia {
msgtype = "m.reaction";
text.erase(text.begin(), text.begin() + 7);
} else {
- fprintf(stderr, "Error: invalid command: %s, expected /upload, /logout, /me or /react\n", text.c_str());
+ show_notification("QuickMedia", "Error: invalid command: " + text + ", expected /upload, /logout, /me or /react", Urgency::NORMAL);
return false;
}
}
@@ -3689,8 +3689,8 @@ namespace QuickMedia {
body_item->embedded_item = std::make_shared<BodyItem>("");
*body_item->embedded_item = *related_body_item;
body_item->embedded_item->reactions.clear();
- if((related_body_item->userdata && static_cast<Message*>(related_body_item->userdata)->user == me) || message_contains_user_mention(related_body_item->get_description(), current_room->get_user_display_name(me)) || message_contains_user_mention(related_body_item->get_description(), me->user_id))
- body_item->embedded_item->set_description_color(sf::Color(255, 100, 100));
+ if(related_body_item->userdata && static_cast<Message*>(related_body_item->userdata)->user == me)
+ body_item->set_description_color(sf::Color(255, 100, 100));
body_item->embedded_item_status = FetchStatus::FINISHED_LOADING;
return;
}
@@ -3713,11 +3713,10 @@ namespace QuickMedia {
// TODO: Optimize from linear search to hash map
auto related_body_item = find_body_item_by_event_id(tabs[MESSAGES_TAB_INDEX].body->items.data(), tabs[MESSAGES_TAB_INDEX].body->items.size(), event_data->event_id);
if(related_body_item) {
- body_item->embedded_item = std::make_shared<BodyItem>("");
- *body_item->embedded_item = *related_body_item;
- body_item->embedded_item->reactions.clear();
- if((related_body_item->userdata && static_cast<Message*>(related_body_item->userdata)->user == me) || message_contains_user_mention(related_body_item->get_description(), current_room->get_user_display_name(me)) || message_contains_user_mention(related_body_item->get_description(), me->user_id))
- body_item->embedded_item->set_description_color(sf::Color(255, 100, 100));
+ *body_item = *related_body_item;
+ body_item->reactions.clear();
+ if(message_contains_user_mention(related_body_item->get_description(), current_room->get_user_display_name(me)) || message_contains_user_mention(related_body_item->get_description(), me->user_id))
+ body_item->set_description_color(sf::Color(255, 100, 100));
event_data->status = FetchStatus::FINISHED_LOADING;
event_data->message = static_cast<Message*>(related_body_item->userdata);
body_item->userdata = event_data;
@@ -3771,7 +3770,7 @@ namespace QuickMedia {
*body_item->embedded_item = *related_body_item;
body_item->embedded_item->reactions.clear();
if((related_body_item->userdata && static_cast<Message*>(related_body_item->userdata)->user == me) || message_contains_user_mention(message->body, current_room->get_user_display_name(me)) || message_contains_user_mention(message->body, me->user_id))
- body_item->embedded_item->set_description_color(sf::Color(255, 100, 100));
+ body_item->set_description_color(sf::Color(255, 100, 100));
body_item->embedded_item_status = FetchStatus::FINISHED_LOADING;
return;
}