Skip to content

Commit

Permalink
Merge pull request #894 from tchapgouv/870-when-inviting-an-extern-er…
Browse files Browse the repository at this point in the history
…ror-message-is-in-english

870 when inviting an extern error message is in english
  • Loading branch information
NicolasBuquet authored Oct 23, 2023
2 parents cea743b + a8fbacb commit 5dec1b4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ class ContactsPickerViewModel: NSObject, ContactsPickerViewModelProtocol {
contactsViewController.showSearch(true)
// Tchap: Replace string by removing user ID
contactsViewController.searchBar.placeholder = VectorL10n.roomParticipantsInviteAnotherUserWithoutId
contactsViewController.searchBar.resignFirstResponder()
// Tchap: don't make searchbar resign as first responder.
// Let it becomes first responder to activate the input field and deploy the keyboard when the controller comes to screen.
// contactsViewController.searchBar.resignFirstResponder()

// Apply the search pattern if any
if currentSearchText != nil {
Expand Down Expand Up @@ -246,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 5dec1b4

Please sign in to comment.