From ef4442c6f58929f2eefb10be218b8d3638d88358 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 10 Sep 2022 23:25:38 +0200 Subject: Revert "Matrix: mark message as deleted with (deleted) instead of removing the text, for in-memory messages" This reverts commit dace5a31e3d853ee56292008cf889bb7d7887741. --- src/QuickMedia.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'src') 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(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? -- cgit v1.2.3