From 68280550878fee1dee0cb89ee333c9cf8f20b121 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Tue, 12 Apr 2022 13:26:04 -0400 Subject: [PATCH] fix(group-chats): fix adding new member to group chat --- src/app/modules/main/chat_section/controller.nim | 5 +++-- src/app/modules/main/chat_section/io_interface.nim | 2 +- src/app/modules/main/chat_section/module.nim | 4 ++-- src/app/modules/main/chat_section/view.nim | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/app/modules/main/chat_section/controller.nim b/src/app/modules/main/chat_section/controller.nim index 93a21744f3..5d58cc3fc1 100644 --- a/src/app/modules/main/chat_section/controller.nim +++ b/src/app/modules/main/chat_section/controller.nim @@ -291,8 +291,9 @@ proc rejectContactRequest*(self: Controller, publicKey: string) = proc blockContact*(self: Controller, publicKey: string) = self.contactService.blockContact(publicKey) -proc addGroupMembers*(self: Controller, communityID: string, chatId: string, pubKeys: seq[string]) = - self.chatService.addGroupMembers(communityID, chatId, pubKeys) +proc addGroupMembers*(self: Controller, chatId: string, pubKeys: seq[string]) = + let communityId = if self.isCommunitySection: self.sectionId else: "" + self.chatService.addGroupMembers(communityId, chatId, pubKeys) proc removeMemberFromGroupChat*(self: Controller, communityID: string, chatId: string, pubKey: string) = self.chatService.removeMemberFromGroupChat(communityID, chatId, pubKey) diff --git a/src/app/modules/main/chat_section/io_interface.nim b/src/app/modules/main/chat_section/io_interface.nim index ae8c4fa7c4..eed317a335 100644 --- a/src/app/modules/main/chat_section/io_interface.nim +++ b/src/app/modules/main/chat_section/io_interface.nim @@ -194,7 +194,7 @@ method rejectAllContactRequests*(self: AccessInterface) {.base.} = method blockContact*(self: AccessInterface, publicKey: string) {.base.} = raise newException(ValueError, "No implementation available") -method addGroupMembers*(self: AccessInterface, communityID: string, chatId: string, pubKeys: string) {.base.} = +method addGroupMembers*(self: AccessInterface, chatId: string, pubKeys: string) {.base.} = raise newException(ValueError, "No implementation available") method removeMemberFromGroupChat*(self: AccessInterface, communityID: string, chatId: string, pubKey: string) {.base.} = diff --git a/src/app/modules/main/chat_section/module.nim b/src/app/modules/main/chat_section/module.nim index 6295f3b17d..e4c0ab582a 100644 --- a/src/app/modules/main/chat_section/module.nim +++ b/src/app/modules/main/chat_section/module.nim @@ -673,8 +673,8 @@ method onMeMentionedInEditedMessage*(self: Module, chatId: string, editedMessage var (sectionHasUnreadMessages, sectionNotificationCount) = self.view.chatsModel().getAllNotifications() self.updateBadgeNotifications(chatId, sectionHasUnreadMessages, sectionNotificationCount + 1) -method addGroupMembers*(self: Module, communityID: string, chatId: string, pubKeys: string) = - self.controller.addGroupMembers(communityID, chatId, self.convertPubKeysToJson(pubKeys)) +method addGroupMembers*(self: Module, chatId: string, pubKeys: string) = + self.controller.addGroupMembers(chatId, self.convertPubKeysToJson(pubKeys)) method removeMemberFromGroupChat*(self: Module, communityID: string, chatId: string, pubKey: string) = self.controller.removeMemberFromGroupChat(communityID, chatId, pubKey) diff --git a/src/app/modules/main/chat_section/view.nim b/src/app/modules/main/chat_section/view.nim index 84ad6d4285..a11d181ed9 100644 --- a/src/app/modules/main/chat_section/view.nim +++ b/src/app/modules/main/chat_section/view.nim @@ -181,8 +181,8 @@ QtObject: proc removeCommunityChat*(self: View, chatId: string) {.slot} = self.delegate.removeCommunityChat(chatId) - proc addGroupMembers*(self: View, communityID: string, chatId: string, pubKeys: string) {.slot.} = - self.delegate.addGroupMembers(communityID, chatId, pubKeys) + proc addGroupMembers*(self: View, chatId: string, pubKeys: string) {.slot.} = + self.delegate.addGroupMembers(chatId, pubKeys) proc removeMemberFromGroupChat*(self: View, communityID: string, chatId: string, pubKey: string) {.slot.} = self.delegate.removeMemberFromGroupChat(communityID, chatId, pubKey)