diff --git a/Vector/ViewController/RoomParticipantsViewController.m b/Vector/ViewController/RoomParticipantsViewController.m index bb1391019..4bca5ace3 100644 --- a/Vector/ViewController/RoomParticipantsViewController.m +++ b/Vector/ViewController/RoomParticipantsViewController.m @@ -1613,6 +1613,9 @@ currentSearchText = searchText; + // Check whether the search input is a valid email or a Matrix user ID + BOOL isValidInput = ([MXTools isEmailAddress:currentSearchText] || [MXTools isMatrixUserIdentifier:currentSearchText]); + isMultiUseNameByDisplayName = [NSMutableDictionary dictionary]; // Update invitable contacts list: @@ -1624,9 +1627,13 @@ { if ([contact hasPrefix:currentSearchText]) { - [invitableContacts addObject:contact]; - - isMultiUseNameByDisplayName[contact.displayName] = (isMultiUseNameByDisplayName[contact.displayName] ? @(YES) : @(NO)); + // Ignore the contact if it corresponds to the search input + if (!isValidInput || [contact.displayName isEqualToString:currentSearchText] == NO) + { + [invitableContacts addObject:contact]; + + isMultiUseNameByDisplayName[contact.displayName] = (isMultiUseNameByDisplayName[contact.displayName] ? @(YES) : @(NO)); + } } } diff --git a/Vector/ViewController/StartChatViewController.m b/Vector/ViewController/StartChatViewController.m index d36b12e8e..9f0110252 100644 --- a/Vector/ViewController/StartChatViewController.m +++ b/Vector/ViewController/StartChatViewController.m @@ -36,10 +36,11 @@ // The contact used to describe the current user. MXKContact *userContact; - // + // Navigation bar items UIBarButtonItem *cancelBarButtonItem; UIBarButtonItem *createBarButtonItem; + // HTTP Request MXHTTPOperation *roomCreationRequest; // Search session