From 7b302c07eff20a71c66bcb2782b54a8389a58c54 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Thu, 16 Nov 2023 13:45:01 -0500 Subject: [PATCH] feat(chat): preserve 1-1 chat history when closing it + rename copy Fixes #12754 --- src/app_service/service/chat/service.nim | 3 +-- src/app_service/service/message/service.nim | 10 ++++------ src/backend/chat.nim | 4 ++-- ui/imports/shared/views/chat/ChatContextMenuView.qml | 6 +++--- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/app_service/service/chat/service.nim b/src/app_service/service/chat/service.nim index 3899eb9c9e..4eca16c031 100644 --- a/src/app_service/service/chat/service.nim +++ b/src/app_service/service/chat/service.nim @@ -489,7 +489,7 @@ QtObject: let leaveGroupResponse = status_chat.leaveGroupChat(chatId) self.emitUpdate(leaveGroupResponse) - discard status_chat.deactivateChat(chatId) + discard status_chat.deactivateChat(chatId, preserveHistory = chat.chatType == chat_dto.ChatType.OneToOne) var channelGroupId = chat.communityId if (channelGroupId == ""): @@ -497,7 +497,6 @@ QtObject: self.channelGroups[channelGroupId].chats.delete(self.getChatIndex(channelGroupId, chatId)) self.chats.del(chatId) - discard status_chat.deleteMessagesByChatId(chatId) self.events.emit(SIGNAL_CHAT_LEFT, ChatArgs(chatId: chatId)) except Exception as e: error "Error deleting channel", chatId, msg = e.msg diff --git a/src/app_service/service/message/service.nim b/src/app_service/service/message/service.nim index 0069ed24f7..70cfe284a7 100644 --- a/src/app_service/service/message/service.nim +++ b/src/app_service/service/message/service.nim @@ -190,12 +190,6 @@ QtObject: result.msgCursor = initTable[string, MessageCursor]() result.pinnedMsgCursor = initTable[string, MessageCursor]() - proc removeMessageWithId(messages: var seq[MessageDto], msgId: string) = - for i in 0..