add checks for federated flag for room

This commit is contained in:
JanNiklas Grabowski
2024-01-26 14:17:55 +01:00
parent 56c544797d
commit 58282bd602
2 changed files with 50 additions and 41 deletions
@@ -318,23 +318,30 @@ extension ContactsPickerViewModel: ContactsTableViewControllerDelegate {
if let identifiere = identifieres.first as? String {
// Check if user is federated
if room.isRoomMemberFederated(identifiere) {
// Get current serverACL settings for room
room.getCurrentRoomServerACLSettings { serverACL in
if let serverACL = serverACL {
if serverACL.elementsEqual("*") {
// Federation is active
canInvite = true
} else {
// Federation is deactivated
self.coordinatorDelegate?.contactsPickerViewModel(self, display: "", title: BWIL10n.roomParticipantsInvitePromptFederationForRoomNotAllowedText, actions: [
UIAlertAction(title: VectorL10n.ok, style: .cancel)
])
// Check if room federation flag "isFederated" is true
room.getFederatedFlag { isFederated in
if isFederated {
// Get current serverACL settings for room
self.room.getCurrentRoomServerACLSettings { serverACL in
if let serverACL = serverACL {
if serverACL.elementsEqual("*") {
// Federation is active
canInvite = true
} else {
// Federation is deactivated
self.coordinatorDelegate?.contactsPickerViewModel(self, display: "", title: BWIL10n.roomParticipantsInvitePromptFederationForRoomNotAllowedText, actions:
[UIAlertAction(title: VectorL10n.ok, style: .cancel)])
}
} else {
// ServerACL not configured
self.coordinatorDelegate?.contactsPickerViewModel(self, display: "", title: BWIL10n.roomParticipantsInvitePromptServerAclForRoomNotConfiguredText, actions:
[UIAlertAction(title: VectorL10n.ok, style: .cancel)])
}
}
} else {
// ServerACL not configured
self.coordinatorDelegate?.contactsPickerViewModel(self, display: "", title: BWIL10n.roomParticipantsInvitePromptServerAclForRoomNotConfiguredText, actions: [
UIAlertAction(title: VectorL10n.ok, style: .cancel)
])
// Federation is deactivated
self.coordinatorDelegate?.contactsPickerViewModel(self, display: "", title: BWIL10n.roomParticipantsInvitePromptFederationForRoomNotAllowedText, actions:
[UIAlertAction(title: VectorL10n.ok, style: .cancel)])
}
}
} else {