From 6c31a2a16a7d23f741bcf7461c4d7e2a000e9de5 Mon Sep 17 00:00:00 2001 From: Vova Ignatov Date: Mon, 29 Sep 2025 12:25:13 +0100 Subject: [PATCH] IOS-5239 Do not show members management controls if used does not have permissions --- .../NewSpaceShare/NewSpaceShareViewModel.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Anytype/Sources/PresentationLayer/Modules/NewSpaceShare/NewSpaceShareViewModel.swift b/Anytype/Sources/PresentationLayer/Modules/NewSpaceShare/NewSpaceShareViewModel.swift index ef8f40bcf2..04f8969acd 100644 --- a/Anytype/Sources/PresentationLayer/Modules/NewSpaceShare/NewSpaceShareViewModel.swift +++ b/Anytype/Sources/PresentationLayer/Modules/NewSpaceShare/NewSpaceShareViewModel.swift @@ -105,8 +105,10 @@ final class NewSpaceShareViewModel: ObservableObject { canChangeInvite = participantSpaceView.permissions.canEditPermissions && participantSpaceView.permissions.canDeleteLink updateUpgradeViewState() - - rows = participants.map { participant in + + let filteredParticipants = participantSpaceView.permissions.canEditPermissions ? participants : participants.filter { $0.status == .active } + + rows = filteredParticipants.map { participant in let isYou = workspaceInfo.profileObjectID == participant.identityProfileLink return SpaceShareParticipantViewModel( id: participant.id, @@ -157,6 +159,7 @@ final class NewSpaceShareViewModel: ObservableObject { } private func participantContextActions(_ participant: Participant) -> [SpaceShareParticipantViewModel.ContextAction] { + guard let participantSpaceView, participantSpaceView.permissions.canEditPermissions else { return [] } guard participant.permission != .owner else { return [] } switch participant.status { case .active: @@ -199,7 +202,7 @@ final class NewSpaceShareViewModel: ObservableObject { } )] : [] case .removing: - return [ + return canApproveRequests ? [ SpaceShareParticipantViewModel.ContextAction( title: Loc.SpaceShare.Action.approve, isSelected: false, @@ -210,7 +213,7 @@ final class NewSpaceShareViewModel: ObservableObject { try await self?.workspaceService.leaveApprove(spaceId: participant.spaceId, identity: participant.identity) self?.toastBarData = ToastBarData(Loc.SpaceShare.Approve.toast(participant.title)) } - )] + )] : [] case .removed, .declined, .canceled, .UNRECOGNIZED(_): return [] }