fix: remove messages when leaving a channel to avoid duplication when rejoining a chat

This commit is contained in:
Richard Ramos 2020-07-08 13:33:45 -04:00 committed by Iuri Matias
parent 2bd3932cec
commit 2183cabad5
2 changed files with 6 additions and 1 deletions

View File

@ -25,7 +25,7 @@ proc handleChatEvents(self: ChatController) =
self.view.setActiveChannel(channel.chat.id)
self.status.events.on("channelLeft") do(e: Args):
discard self.view.chats.removeChatItemFromList(self.view.activeChannel.chatItem.id)
self.view.removeChat(self.view.activeChannel.chatItem.id)
self.status.events.on("activeChannelChanged") do(e: Args):
self.view.setActiveChannel(ChatIdArg(e).chatId)

View File

@ -195,6 +195,11 @@ QtObject:
proc leaveActiveChat*(self: ChatsView) {.slot.} =
self.status.chat.leave(self.activeChannel.id)
proc removeChat*(self: ChatsView, chatId: string) =
discard self.chats.removeChatItemFromList(chatId)
self.messageList[chatId].delete
self.messageList.del(chatId)
proc clearChatHistory*(self: ChatsView, id: string) {.slot.} =
self.status.chat.clearHistory(id)