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.
This commit is contained in:
parent
0d3cb065fb
commit
c4928cfe40
|
@ -389,7 +389,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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)):
|
||||
|
|
Loading…
Reference in New Issue