fix: request mailserver messages for group and 1:1 chats
This commit is contained in:
parent
22f4815957
commit
971dca5fb8
|
@ -139,16 +139,18 @@ proc init*(self: ChatModel) =
|
||||||
|
|
||||||
var topics:seq[MailserverTopic] = @[]
|
var topics:seq[MailserverTopic] = @[]
|
||||||
let parsedResult = parseJson(filterResult)["result"]
|
let parsedResult = parseJson(filterResult)["result"]
|
||||||
for topicObj in parsedResult:
|
for filter in parsedResult:
|
||||||
# Only add topics for chats the user has joined
|
# Only add topics for chats the user has joined
|
||||||
let topic_chat = topicObj["chatId"].getStr
|
let topic_chat = filter["chatId"].getStr
|
||||||
if self.channels.hasKey(topic_chat) and self.channels[topic_chat].isActive:
|
let identity = filter["identity"].getStr
|
||||||
|
let chatId = if self.channels.hasKey(topic_chat): topic_chat else: "0x" & identity
|
||||||
|
|
||||||
|
if self.channels.hasKey(chatId) and self.channels[chatId].isActive:
|
||||||
topics.add(MailserverTopic(
|
topics.add(MailserverTopic(
|
||||||
topic: $topicObj["topic"].getStr,
|
topic: $filter["topic"].getStr,
|
||||||
discovery: topicObj["discovery"].getBool,
|
discovery: filter["discovery"].getBool,
|
||||||
negotiated: topicObj["negotiated"].getBool,
|
negotiated: filter["negotiated"].getBool,
|
||||||
chatIds: @[self.channels[topic_chat].id],
|
chatIds: @[chatId],
|
||||||
lastRequest: 1
|
lastRequest: 1
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue