From 1a12cc455958f898216248c827ba94813439a5c0 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Tue, 4 Jun 2024 12:46:10 -0400 Subject: [PATCH] fix: set joined to all members of the comm since they are in the list (#15016) Fixes #14994 If you are part of the community member list, it means you are joined. It made no sense to add conditions to it. --- src/app/modules/main/module.nim | 1 - src/app_service/service/chat/dto/chat.nim | 5 ++++- src/app_service/service/community/dto/community.nim | 4 +--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/modules/main/module.nim b/src/app/modules/main/module.nim index dbf4a19eef..275a6a53e8 100644 --- a/src/app/modules/main/module.nim +++ b/src/app/modules/main/module.nim @@ -387,7 +387,6 @@ proc createCommunitySectionItem[T](self: Module[T], communityDetails: CommunityD communityDetails.muted, # members members.map(proc(member: ChatMember): MemberItem = - let contactDetails = self.controller.getContactDetails(member.id) var state = MembershipRequestState.Accepted if member.id in communityDetails.pendingAndBannedMembers: let memberState = communityDetails.pendingAndBannedMembers[member.id].toMembershipRequestState() diff --git a/src/app_service/service/chat/dto/chat.nim b/src/app_service/service/chat/dto/chat.nim index 622da11e77..df6b1a25b7 100644 --- a/src/app_service/service/chat/dto/chat.nim +++ b/src/app_service/service/chat/dto/chat.nim @@ -209,7 +209,7 @@ proc toGroupChatMember*(jsonObj: JsonNode): ChatMember = result.role = if admin: MemberRole.Owner else: MemberRole.None result.joined = true -proc toChannelMember*(jsonObj: JsonNode, memberId: string, joined: bool): ChatMember = +proc toChannelMember*(jsonObj: JsonNode, memberId: string): ChatMember = # Parse status-go "CommunityMember" type # Mapping this DTO is not straightforward since only keys are used for id. We # handle it a bit different. @@ -221,6 +221,9 @@ proc toChannelMember*(jsonObj: JsonNode, memberId: string, joined: bool): ChatMe for roleObj in rolesObj: roles.add(roleObj.getInt) + # People in the community members' list are joined by default + result.joined = true + result.role = MemberRole.None if roles.contains(MemberRole.Owner.int): result.role = MemberRole.Owner diff --git a/src/app_service/service/community/dto/community.nim b/src/app_service/service/community/dto/community.nim index 6ed0b16062..78483c53f3 100644 --- a/src/app_service/service/community/dto/community.nim +++ b/src/app_service/service/community/dto/community.nim @@ -445,10 +445,8 @@ proc toCommunityDto*(jsonObj: JsonNode): CommunityDto = var membersObj: JsonNode if(jsonObj.getProp("members", membersObj) and membersObj.kind == JObject): - # Do not show members list in closed communities - let joined = result.isMember or result.tokenPermissions.len == 0 for memberId, memberObj in membersObj: - result.members.add(toChannelMember(memberObj, memberId, joined)) + result.members.add(toChannelMember(memberObj, memberId)) var tagsObj: JsonNode if(jsonObj.getProp("tags", tagsObj)):