fix: create one to one chat (#98)

Even if the chat exists, we need to update it and mark it as
active in case it already exists and is not active
This commit is contained in:
Anthony Laibe 2021-11-10 20:47:41 +01:00 committed by GitHub
parent 5417274a3b
commit 0a8674c5cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -211,6 +211,8 @@ proc join*(self: ChatModel, chatId: string, chatType: ChatType, ensName: string
proc createOneToOneChat*(self: ChatModel, publicKey: string, ensName: string = "") = proc createOneToOneChat*(self: ChatModel, publicKey: string, ensName: string = "") =
if self.hasChannel(publicKey): if self.hasChannel(publicKey):
# We want to show the chat to the user and for that we activate the chat
status_chat.saveChat(publicKey, ChatType.OneToOne, color=self.channels[publicKey].color, ensName=ensName)
self.emitTopicAndJoin(self.channels[publicKey]) self.emitTopicAndJoin(self.channels[publicKey])
return return