Remove zombie channels from the chat list
This commit is contained in:
parent
6a22c0275f
commit
ec2ce2818d
|
@ -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
|
||||
|
||||
|
|
|
@ -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) =
|
||||
|
|
Loading…
Reference in New Issue