From 61555d610bdb4fb33d10c2481a246dfed66ffb96 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Mon, 5 Apr 2021 14:11:06 -0400 Subject: [PATCH] fix: it's not necessary to leave chats --- src/status/chat.nim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/status/chat.nim b/src/status/chat.nim index 16a3b800e3..8acaf6470d 100644 --- a/src/status/chat.nim +++ b/src/status/chat.nim @@ -93,7 +93,6 @@ proc update*(self: ChatModel, chats: seq[Chat], messages: seq[Message], emojiRea if contact.address == member.id: isContact = true if not isContact and not joined: - discard status_chat.leaveGroupChat(chat.id) status_chat.deactivateChat(chat) continue @@ -154,7 +153,8 @@ proc updateContacts*(self: ChatModel, contacts: seq[Profile]) = self.events.emit("chatUpdate", ChatUpdateArgs(contacts: contacts)) -proc deleteSpamGroupChats(self: ChatModel, chats: seq[Chat], contacts: seq[Profile]) = +proc deleteSpamGroupChats(self: ChatModel, contacts: seq[Profile]) = + var chats = status_chat.loadChats() for chat in chats: if chat.chatType == ChatType.PrivateGroupChat: var isContact = false @@ -167,17 +167,17 @@ proc deleteSpamGroupChats(self: ChatModel, chats: seq[Chat], contacts: seq[Profi if contact.address == member.id: isContact = true if not isContact and not joined: - discard status_chat.leaveGroupChat(chat.id) status_chat.deactivateChat(chat) proc init*(self: ChatModel, pubKey: string) = self.publicKey = pubKey - var chatList = status_chat.loadChats() var contacts = getAddedContacts() - self.deleteSpamGroupChats(chatList, contacts) + self.deleteSpamGroupChats(contacts) + + var chatList = status_chat.loadChats() let profileUpdatesChatIds = chatList.filter(c => c.chatType == ChatType.Profile).map(c => c.id)