From dace5a31e3d853ee56292008cf889bb7d7887741 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 10 Sep 2022 23:16:06 +0200 Subject: Matrix: mark message as deleted with (deleted) instead of removing the text, for in-memory messages --- src/QuickMedia.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index fa8dd66..6ed695b 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -5462,28 +5462,21 @@ 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 = [¤t_room](Message *message, BodyItem *body_item) { + auto set_body_as_deleted = [](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 && !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; + 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 } - 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