Remove zombie channels from the chat list

This commit is contained in:
Richard Ramos 2020-06-13 18:03:16 -04:00 committed by Iuri Matias
parent 6a22c0275f
commit ec2ce2818d
2 changed files with 7 additions and 3 deletions

View File

@ -73,9 +73,13 @@ QtObject:
proc upsertChannel(self: ChannelsList, channel: Chat): int =
let idx = self.chats.findIndexById(channel.id)
if idx == -1:
if channel.isActive:
# We only want to add a channel to the list if it is active
# otherwise, we'll end up with zombie channels on the list
result = self.addChatItemToList(channel)
else:
result = -1
else:
result = idx

View File

@ -119,7 +119,7 @@ proc leave*(self: ChatModel, chatId: string) =
self.filters.del(chatId)
self.channels.del(chatId)
self.events.emit("channelLeft", ChatIdArg(chatId: chatId))
self.events.emit("activeChannelChanged", ChatIdArg(chatId: self.getActiveChannel()))
self.events.emit("activeChannelChanged", ChatIdArg(chatId: ""))
proc setActiveChannel*(self: ChatModel, chatId: string) =