diff --git a/src/app/modules/main/chat_section/controller.nim b/src/app/modules/main/chat_section/controller.nim index 252652e91f..7162c43e59 100644 --- a/src/app/modules/main/chat_section/controller.nim +++ b/src/app/modules/main/chat_section/controller.nim @@ -298,7 +298,6 @@ proc init*(self: Controller) = if (args.communityId == self.sectionId): self.delegate.onCommunityTokenMetadataAdded(args.communityId, args.tokenMetadata) - self.events.on(SIGNAL_WALLET_ACCOUNT_TOKENS_REBUILT) do(e: Args): self.delegate.onWalletAccountTokensRebuilt() diff --git a/src/app/modules/main/communities/models/pending_request_item.nim b/src/app/modules/main/communities/models/pending_request_item.nim index 72e8109692..a27ac5ae13 100644 --- a/src/app/modules/main/communities/models/pending_request_item.nim +++ b/src/app/modules/main/communities/models/pending_request_item.nim @@ -1,3 +1,5 @@ +import strformat + type PendingRequestItem* = ref object id: string @@ -40,3 +42,13 @@ proc state*(self: PendingRequestItem): int = proc our*(self: PendingRequestItem): string = self.our + +proc `$`*(self: PendingRequestItem): string = + result = fmt"""PendingRequestItem( + id: {self.id}, + publicKey: {$self.publicKey}, + chatId: {$self.chatId}, + communityId: {$self.communityId}, + state: {$self.state}, + our: {$self.our}, + ]""" \ No newline at end of file diff --git a/src/app/modules/main/module.nim b/src/app/modules/main/module.nim index 8b9432751d..d0f052aa33 100644 --- a/src/app/modules/main/module.nim +++ b/src/app/modules/main/module.nim @@ -287,6 +287,7 @@ proc createChannelGroupItem[T](self: Module[T], channelGroup: ChannelGroupDto): channelGroup.permissions.access, channelGroup.permissions.ensOnly, channelGroup.muted, + # members channelGroup.members.map(proc(member: ChatMember): MemberItem = let contactDetails = self.controller.getContactDetails(member.id) result = initMemberItem( @@ -303,6 +304,7 @@ proc createChannelGroupItem[T](self: Module[T], channelGroup: ChannelGroupDto): isVerified = contactDetails.details.isContactVerified(), isAdmin = member.admin )), + # pendingRequestsToJoin if (isCommunity): communityDetails.pendingRequestsToJoin.map(x => pending_request_item.initItem( x.id, x.publicKey, @@ -313,6 +315,7 @@ proc createChannelGroupItem[T](self: Module[T], channelGroup: ChannelGroupDto): )) else: @[], communityDetails.settings.historyArchiveSupportEnabled, communityDetails.adminSettings.pinMessageAllMembersEnabled, + # bannedMembers channelGroup.bannedMembersIds.map(proc(bannedMemberId: string): MemberItem= let contactDetails = self.controller.getContactDetails(bannedMemberId) result = initMemberItem( @@ -329,6 +332,7 @@ proc createChannelGroupItem[T](self: Module[T], channelGroup: ChannelGroupDto): isVerified = contactDetails.details.isContactVerified() ) ), + # pendingMemberRequests if (isCommunity): communityDetails.pendingRequestsToJoin.map(proc(requestDto: CommunityMembershipRequestDto): MemberItem = let contactDetails = self.controller.getContactDetails(requestDto.publicKey) result = initMemberItem( @@ -346,6 +350,7 @@ proc createChannelGroupItem[T](self: Module[T], channelGroup: ChannelGroupDto): requestToJoinId = requestDto.id ) ) else: @[], + # declinedMemberRequests if (isCommunity): communityDetails.declinedRequestsToJoin.map(proc(requestDto: CommunityMembershipRequestDto): MemberItem = let contactDetails = self.controller.getContactDetails(requestDto.publicKey) result = initMemberItem( diff --git a/src/app_service/service/community/service.nim b/src/app_service/service/community/service.nim index ef39a565b0..ef886adf55 100644 --- a/src/app_service/service/community/service.nim +++ b/src/app_service/service/community/service.nim @@ -191,7 +191,7 @@ QtObject: proc declinedRequestsToJoinForCommunity*(self: Service, communityId: string): seq[CommunityMembershipRequestDto] proc canceledRequestsToJoinForCommunity*(self: Service, communityId: string): seq[CommunityMembershipRequestDto] proc getPendingRequestIndex(self: Service, communityId: string, requestId: string): int - proc removeMembershipRequestFromCommunityAndGetMemberPubkey*(self: Service, communityId: string, requestId: string): string + proc removeMembershipRequestFromCommunityAndGetMemberPubkey*(self: Service, communityId: string, requestId: string, updatedCommunity: CommunityDto): string proc getUserPubKeyFromPendingRequest*(self: Service, communityId: string, requestId: string): string proc delete*(self: Service) = @@ -1356,12 +1356,14 @@ QtObject: self.events.emit(SIGNAL_ACCEPT_REQUEST_TO_JOIN_FAILED, CommunityMemberArgs(communityId: communityId, pubKey: userKey, requestId: requestId)) return - discard self.removeMembershipRequestFromCommunityAndGetMemberPubkey(communityId, requestId) + discard self.removeMembershipRequestFromCommunityAndGetMemberPubkey(communityId, requestId, + rpcResponseObj["response"]["result"]["communities"][0].toCommunityDto) if (userKey == ""): error "Did not find pubkey in the pending request" return + self.events.emit(SIGNAL_COMMUNITY_EDITED, CommunityArgs(community: self.communities[communityId])) self.events.emit(SIGNAL_COMMUNITY_MEMBER_APPROVED, CommunityMemberArgs(communityId: communityId, pubKey: userKey, requestId: requestId)) except Exception as e: @@ -1491,7 +1493,8 @@ QtObject: i.inc() return -1 - proc removeMembershipRequestFromCommunityAndGetMemberPubkey*(self: Service, communityId: string, requestId: string): string = + proc removeMembershipRequestFromCommunityAndGetMemberPubkey*(self: Service, communityId: string, requestId: string, + updatedCommunity: CommunityDto): string = let indexPending = self.getPendingRequestIndex(communityId, requestId) let indexDeclined = self.getDeclinedRequestIndex(communityId, requestId) @@ -1507,6 +1510,7 @@ QtObject: result = community.declinedRequestsToJoin[indexDeclined].publicKey community.declinedRequestsToJoin.delete(indexDeclined) + community.members = updatedCommunity.members self.communities[communityId] = community proc moveRequestToDeclined*(self: Service, communityId: string, requestId: string) = @@ -1515,10 +1519,10 @@ QtObject: raise newException(RpcException, fmt"Community request not found: {requestId}") var community = self.communities[communityId] - if (indexPending != -1): - let itemToMove = community.pendingRequestsToJoin[indexPending] - community.declinedRequestsToJoin.add(itemToMove) - community.pendingRequestsToJoin.delete(indexPending) + + let itemToMove = community.pendingRequestsToJoin[indexPending] + community.declinedRequestsToJoin.add(itemToMove) + community.pendingRequestsToJoin.delete(indexPending) self.communities[communityId] = community diff --git a/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml b/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml index ca58ee9afe..915354e6b5 100644 --- a/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml +++ b/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml @@ -222,7 +222,7 @@ StatusSectionLayout { onAirdropTokensClicked: { /* TODO in future */ } onBackUpClicked: { Global.openPopup(transferOwnershipPopup, { - privateKey: root.chatCommunitySectionModule.exportCommunity(root.communityId), + privateKey: root.chatCommunitySectionModule.exportCommunity(root.community.id), }) } onPreviousPageNameChanged: root.backButtonName = previousPageName diff --git a/vendor/status-go b/vendor/status-go index becc49ac24..329f5c8316 160000 --- a/vendor/status-go +++ b/vendor/status-go @@ -1 +1 @@ -Subproject commit becc49ac24383bc1096ad77a24093fdfc43f60ba +Subproject commit 329f5c831682f73b8182db955716ed3e713670fa