From 13cc76f2afad198d0af4a281ebfbb8e16473291d Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Mon, 6 May 2024 18:34:24 +0200 Subject: [PATCH] =?UTF-8?q?Invitations=20:=20forcer=20l'email=20en=20minus?= =?UTF-8?q?cules=20=C3=A0=20l'envoi=20d'invitation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ContactsPicker/ContactsPickerViewModel.swift | 7 ++++++- Riot/Modules/StartChat/StartChatViewController.m | 4 +++- changelog.d/1024.change | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 changelog.d/1024.change diff --git a/Riot/Modules/Room/ParticipantsInviteModal/ContactsPicker/ContactsPickerViewModel.swift b/Riot/Modules/Room/ParticipantsInviteModal/ContactsPicker/ContactsPickerViewModel.swift index ba73bea30..7bbd931da 100644 --- a/Riot/Modules/Room/ParticipantsInviteModal/ContactsPicker/ContactsPickerViewModel.swift +++ b/Riot/Modules/Room/ParticipantsInviteModal/ContactsPicker/ContactsPickerViewModel.swift @@ -128,6 +128,9 @@ class ContactsPickerViewModel: NSObject, ContactsPickerViewModelProtocol { contactsViewController.showSearch(true) // Tchap: Replace string by removing user ID contactsViewController.searchBar.placeholder = VectorL10n.roomParticipantsInviteAnotherUserWithoutId + // Tchap: don't force capitalization of first char of search input (to protect capitalization of email) + // when inviting a participant in a room. + contactsViewController.searchBar.searchTextField.autocapitalizationType = .none // 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() @@ -279,7 +282,9 @@ extension ContactsPickerViewModel: ContactsTableViewControllerDelegate { self.coordinatorDelegate?.contactsPickerViewModelDidStartInvite(self) // Is it an email or a Matrix user ID? if MXTools.isEmailAddress(participantId) { - room.invite(.email(participantId)) { [weak self] response in + // Tchap: be sure to convert email address to lowercase. +// room.invite(.email(participantId)) { [weak self] response in + room.invite(.email(participantId.lowercased())) { [weak self] response in guard let self = self else { return } switch response { diff --git a/Riot/Modules/StartChat/StartChatViewController.m b/Riot/Modules/StartChat/StartChatViewController.m index fc5467ebd..deb09d3ac 100644 --- a/Riot/Modules/StartChat/StartChatViewController.m +++ b/Riot/Modules/StartChat/StartChatViewController.m @@ -708,7 +708,9 @@ - (IBAction)onButtonPressed:(id)sender MXInvite3PID *invite3PID = [[MXInvite3PID alloc] init]; invite3PID.identityServer = identityServer; invite3PID.medium = kMX3PIDMediumEmail; - invite3PID.address = participantId; + // Tchap: be sure to convert email address to lowercase +// invite3PID.address = participantId; + invite3PID.address = participantId.lowercaseString; [invite3PIDArray addObject:invite3PID]; } diff --git a/changelog.d/1024.change b/changelog.d/1024.change new file mode 100644 index 000000000..c3c50fdc6 --- /dev/null +++ b/changelog.d/1024.change @@ -0,0 +1 @@ +forcer l'email en minuscules à l'envoi d'invitation à un salon (pour éviter les problèmes d'email avec majuscules) \ No newline at end of file