fix(chat): only add active chats (fixes chats reappearing after leaving)
Fixes #4903
This commit is contained in:
parent
13b81134de
commit
a910a3e801
|
@ -110,9 +110,12 @@ QtObject:
|
|||
|
||||
# Handling chat updates
|
||||
if (receivedData.chats.len > 0):
|
||||
var chats: seq[ChatDto] = @[]
|
||||
for chatDto in receivedData.chats:
|
||||
self.updateOrAddChat(chatDto)
|
||||
self.events.emit(SIGNAL_CHAT_UPDATE, ChatUpdateArgsNew(messages: receivedData.messages, chats: receivedData.chats))
|
||||
if (chatDto.active):
|
||||
chats.add(chatDto)
|
||||
self.updateOrAddChat(chatDto)
|
||||
self.events.emit(SIGNAL_CHAT_UPDATE, ChatUpdateArgsNew(messages: receivedData.messages, chats: chats))
|
||||
|
||||
proc init*(self: Service) =
|
||||
self.doConnect()
|
||||
|
|
|
@ -138,6 +138,9 @@ QtObject:
|
|||
error "error: received `chats` array for handling messages update is empty"
|
||||
return
|
||||
|
||||
if (not chats[0].active):
|
||||
return
|
||||
|
||||
let chatId = chats[0].id
|
||||
let chatType = chats[0].chatType
|
||||
let unviewedMessagesCount = chats[0].unviewedMessagesCount
|
||||
|
|
Loading…
Reference in New Issue