Skip to content

Commit

Permalink
Merge pull request #1032 from tchapgouv/1024-invitations-forcer-lemai…
Browse files Browse the repository at this point in the history
…l-en-minuscules-a-lenvoi-dinvitation

Invitations : forcer l'email en minuscules à l'envoi d'invitation
  • Loading branch information
NicolasBuquet authored May 13, 2024
2 parents 4d968a2 + 13cc76f commit aaeeafd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion Riot/Modules/StartChat/StartChatViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down
1 change: 1 addition & 0 deletions changelog.d/1024.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
forcer l'email en minuscules à l'envoi d'invitation à un salon (pour éviter les problèmes d'email avec majuscules)

0 comments on commit aaeeafd

Please sign in to comment.