diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-09-10 23:16:06 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-09-10 23:16:06 +0200 |
commit | dace5a31e3d853ee56292008cf889bb7d7887741 (patch) | |
tree | efa3029c27c72ac2403f0abf93fc3606880c5830 | |
parent | 0ea083cbd4013cf2e709a3e3810ae96167585a74 (diff) |
Matrix: mark message as deleted with (deleted) instead of removing the text, for in-memory messages
-rw-r--r-- | src/QuickMedia.cpp | 23 |
1 files changed, 8 insertions, 15 deletions
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<Message*>(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? |