From d4944fd662c5f6753e034f41d773f83a90d70617 Mon Sep 17 00:00:00 2001 From: Patryk Osmaczko Date: Thu, 11 Jan 2024 16:54:01 +0100 Subject: [PATCH] fix(communities): make users module always use channels members This fixes members list of the channels. The conficting signal, `SIGNAL_COMMUNITY_MEMBERS_CHANGED`, was causing it to always show all members. As a consequence, it enables mentioning only members of a given channel. closes: #12384 --- .../chat_content/users/controller.nim | 17 ----------------- src/app_service/service/community/service.nim | 2 +- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/src/app/modules/main/chat_section/chat_content/users/controller.nim b/src/app/modules/main/chat_section/chat_content/users/controller.nim index ecebc93bc9..b5a8393e57 100644 --- a/src/app/modules/main/chat_section/chat_content/users/controller.nim +++ b/src/app/modules/main/chat_section/chat_content/users/controller.nim @@ -46,19 +46,6 @@ proc newController*( proc delete*(self: Controller) = self.events.disconnect() -proc handleCommunityOnlyConnections(self: Controller) = - self.events.on(SIGNAL_COMMUNITY_MEMBER_APPROVED) do(e: Args): - let args = CommunityMemberArgs(e) - if (args.communityId == self.sectionId): - self.delegate.onChatMembersAdded(@[args.pubKey]) - - self.events.on(SIGNAL_COMMUNITY_MEMBERS_CHANGED) do(e:Args): - let args = CommunityMembersArgs(e) - if args.communityId != self.sectionId: - return - - self.delegate.onMembersChanged(args.members) - proc init*(self: Controller) = # Events that are needed for all chats because of mentions self.events.on(SIGNAL_CONTACT_NICKNAME_CHANGED) do(e: Args): @@ -125,10 +112,6 @@ proc init*(self: Controller) = if (args.chatId == self.chatId): self.delegate.onChatMemberUpdated(args.id, args.role, args.joined) - # Events only for community channel - if (self.belongsToCommunity): - self.handleCommunityOnlyConnections() - proc belongsToCommunity*(self: Controller): bool = self.belongsToCommunity diff --git a/src/app_service/service/community/service.nim b/src/app_service/service/community/service.nim index 449ad2a668..7f7311538c 100644 --- a/src/app_service/service/community/service.nim +++ b/src/app_service/service/community/service.nim @@ -629,7 +629,7 @@ QtObject: self.chatService.updateChannelMembers(chat) # members list was changed - if (community.isMember or community.tokenPermissions.len == 0) and community.members != prev_community.members: + if community.members != prev_community.members: self.events.emit(SIGNAL_COMMUNITY_MEMBERS_CHANGED, CommunityMembersArgs(communityId: community.id, members: community.members))