diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-09-10 23:25:38 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-09-10 23:25:38 +0200 |
commit | ef4442c6f58929f2eefb10be218b8d3638d88358 (patch) | |
tree | 119f1fb52c94442d7d01d1a7992ac1a9f3b387a6 /src | |
parent | dace5a31e3d853ee56292008cf889bb7d7887741 (diff) |
Revert "Matrix: mark message as deleted with (deleted) instead of removing the text, for in-memory messages"
This reverts commit dace5a31e3d853ee56292008cf889bb7d7887741.
Diffstat (limited to 'src')
-rw-r--r-- | src/QuickMedia.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 6ed695b..fa8dd66 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -5462,21 +5462,28 @@ namespace QuickMedia { // TODO: What if these never end up referencing events? clean up automatically after a while? Messages unreferenced_events; - auto set_body_as_deleted = [](Message *message, BodyItem *body_item) { + auto set_body_as_deleted = [¤t_room](Message *message, BodyItem *body_item) { //body_item->embedded_item = nullptr; //body_item->embedded_item_status = FetchStatus::NONE; message->type = MessageType::REDACTION; //message->related_event_id.clear(); //message->related_event_type = RelatedEventType::NONE; Message *original_message = static_cast<Message*>(body_item->userdata); - if(original_message && original_message->type != MessageType::REDACTION) { - body_item->set_description(body_item->get_description() + " (deleted)"); - if(is_system_message_type(original_message->type)) - body_item->set_description_color(get_theme().faded_text_color); - else - body_item->set_description_color(get_theme().text_color); - original_message->type = MessageType::REDACTION; // shit garbage fuck + if(original_message && !is_system_message_type(original_message->type)) { + body_item->thumbnail_url = current_room->get_user_avatar_url(original_message->user); + if(body_item->thumbnail_url.empty()) { + body_item->thumbnail_url = get_resource_loader_root_path() + std::string("images/no_avatar.png"); + body_item->thumbnail_is_local = true; + } + body_item->thumbnail_mask_type = ThumbnailMaskType::CIRCLE; } + body_item->set_description("Message deleted"); + if(original_message && is_system_message_type(original_message->type)) + body_item->set_description_color(get_theme().faded_text_color); + else + body_item->set_description_color(get_theme().text_color); + body_item->thumbnail_size = AVATAR_THUMBNAIL_SIZE; + body_item->url.clear(); }; // TODO: Optimize with hash map? |