Skip to content

Commit

Permalink
Display a more friendly error when a user can't be invited to a room …
Browse files Browse the repository at this point in the history
…(previously, a generic back-end error message in english was displayed)
  • Loading branch information
Nicolas Buquet committed Oct 23, 2023
1 parent f202262 commit e4d24c0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,15 @@ extension ContactsPickerViewModel: ContactsTableViewControllerDelegate {
self.coordinatorDelegate?.contactsPickerViewModelDidEndInvite(self)
case .failure:
MXLog.error("[ContactsPickerViewModel] Failed to invite participant", context: response.error)
self.coordinatorDelegate?.contactsPickerViewModel(self, inviteFailedWithError: response.error)
// Tchap: make error message clearer and in french when a member can't be invited to a room
if let mxError = MXError(nsError: response.error),
mxError.errcode == kMXErrCodeStringForbidden,
let tchapErrorCannotInvite = MXError(errorCode: mxError.errcode, error: TchapL10n.roomInviteErrorActionForbidden, userInfo: mxError.userInfo) {
self.coordinatorDelegate?.contactsPickerViewModel(self, inviteFailedWithError: tchapErrorCannotInvite.createNSError())
}
else {
self.coordinatorDelegate?.contactsPickerViewModel(self, inviteFailedWithError: response.error)
}
}
}
} else {
Expand Down
4 changes: 4 additions & 0 deletions Tchap/Assets/Localizations/fr.lproj/Tchap.strings
Original file line number Diff line number Diff line change
Expand Up @@ -309,3 +309,7 @@
////////////////////////////////////////////////////////////////////////////////
// MARK: Room Decryption error
"room_decryption_error_faq_link_message" = "Sinon, consulter cet article de FAQ.";

////////////////////////////////////////////////////////////////////////////////
// MARK: Room Invite
"room_invite_error_action_forbidden" = "Cet utilisateur n'est pas autorisé à rejoindre ce salon.";

0 comments on commit e4d24c0

Please sign in to comment.