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
|
# Handling chat updates
|
||||||
if (receivedData.chats.len > 0):
|
if (receivedData.chats.len > 0):
|
||||||
|
var chats: seq[ChatDto] = @[]
|
||||||
for chatDto in receivedData.chats:
|
for chatDto in receivedData.chats:
|
||||||
self.updateOrAddChat(chatDto)
|
if (chatDto.active):
|
||||||
self.events.emit(SIGNAL_CHAT_UPDATE, ChatUpdateArgsNew(messages: receivedData.messages, chats: receivedData.chats))
|
chats.add(chatDto)
|
||||||
|
self.updateOrAddChat(chatDto)
|
||||||
|
self.events.emit(SIGNAL_CHAT_UPDATE, ChatUpdateArgsNew(messages: receivedData.messages, chats: chats))
|
||||||
|
|
||||||
proc init*(self: Service) =
|
proc init*(self: Service) =
|
||||||
self.doConnect()
|
self.doConnect()
|
||||||
|
|
|
@ -138,6 +138,9 @@ QtObject:
|
||||||
error "error: received `chats` array for handling messages update is empty"
|
error "error: received `chats` array for handling messages update is empty"
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if (not chats[0].active):
|
||||||
|
return
|
||||||
|
|
||||||
let chatId = chats[0].id
|
let chatId = chats[0].id
|
||||||
let chatType = chats[0].chatType
|
let chatType = chats[0].chatType
|
||||||
let unviewedMessagesCount = chats[0].unviewedMessagesCount
|
let unviewedMessagesCount = chats[0].unviewedMessagesCount
|
||||||
|
|
Loading…
Reference in New Issue