mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-24 02:22:44 +02:00
SP1.2: Invite to Space in room landing element-ios#5225
- Check user permissions to invite people
This commit is contained in:
@@ -138,10 +138,27 @@ extension SpaceMembersCoordinator: SpaceMemberListCoordinatorDelegate {
|
||||
return
|
||||
}
|
||||
|
||||
let coordinator = ContactsPickerCoordinator(session: parameters.session, room: spaceRoom, currentSearchText: nil, actualParticipants: nil, invitedParticipants: nil, userParticipant: nil, navigationRouter: navigationRouter)
|
||||
coordinator.delegate = self
|
||||
coordinator.start()
|
||||
childCoordinators.append(coordinator)
|
||||
spaceRoom.state { [weak self] roomState in
|
||||
guard let self = self else { return }
|
||||
|
||||
guard let powerLevels = roomState?.powerLevels, let userId = self.parameters.session.myUserId else {
|
||||
MXLog.error("[RoomParticipantsInviteCoordinatorBridgePresenter] present: powerLevels room found")
|
||||
return
|
||||
}
|
||||
let userPowerLevel = powerLevels.powerLevelOfUser(withUserID: userId)
|
||||
|
||||
guard userPowerLevel >= powerLevels.invite else {
|
||||
let alert = UIAlertController(title: VectorL10n.spacesInvitePeople, message: VectorL10n.spaceInviteNotEnoughPermission, preferredStyle: .alert)
|
||||
alert.addAction(UIAlertAction(title: VectorL10n.ok, style: .default, handler: nil))
|
||||
self.navigationRouter.present(alert, animated: true)
|
||||
return
|
||||
}
|
||||
|
||||
let coordinator = ContactsPickerCoordinator(session: self.parameters.session, room: spaceRoom, currentSearchText: nil, actualParticipants: nil, invitedParticipants: nil, userParticipant: nil, navigationRouter: self.navigationRouter)
|
||||
coordinator.delegate = self
|
||||
coordinator.start()
|
||||
self.childCoordinators.append(coordinator)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user