Skip to content

Commit 72f098c

Browse files
AntoLClunika
authored andcommitted
🐛(frontend) email case sensitive search modal
When a user was searching for an email in the share modal, the search was case sensitive, so we were proposing to send an invitation to a new user when in fact the user was already registered. The search is now case insensitive, so the only choice is to add the existing user in the share list.
1 parent 3b08ba4 commit 72f098c

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

src/frontend/apps/e2e/__tests__/app-impress/doc-member-create.spec.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,15 @@ test.describe('Document create member', () => {
169169

170170
const inputSearch = page.getByTestId('quick-search-input');
171171

172-
const email = randomName('[email protected]', browserName, 1)[0];
172+
let email = '[email protected]';
173173
await inputSearch.fill(email);
174+
175+
// Check email is found in search (case insensitive)
176+
await expect(page.getByRole('option').getByText(email)).toHaveCount(1);
177+
178+
email = email + 'M';
179+
await inputSearch.fill(email);
180+
174181
await page.getByTestId(`search-user-row-${email}`).click();
175182

176183
// Choose a role
@@ -191,7 +198,7 @@ test.describe('Document create member', () => {
191198

192199
const listInvitation = page.getByTestId('doc-share-quick-search');
193200
const userInvitation = listInvitation.getByTestId(
194-
`doc-share-invitation-row-${email}`,
201+
`doc-share-invitation-row-${email.toLowerCase()}`,
195202
);
196203
await expect(userInvitation).toBeVisible();
197204

src/frontend/apps/impress/src/features/docs/doc-share/components/DocShareAddMemberList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export const DocShareAddMemberList = ({
9191
return isInvitationMode
9292
? createInvitation({
9393
...payload,
94-
email: user.email,
94+
email: user.email.toLowerCase(),
9595
})
9696
: createDocAccess({
9797
...payload,

src/frontend/apps/impress/src/features/docs/doc-share/components/DocShareModal.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,9 @@ const QuickSearchInviteInputSection = ({
296296
language: '',
297297
};
298298

299-
const hasEmailInUsers = users.some((user) => user.email === userQuery);
299+
const hasEmailInUsers = users.some(
300+
(user) => user.email.toLowerCase() === userQuery.toLowerCase(),
301+
);
300302

301303
return {
302304
groupName: t('Search user result'),

src/frontend/apps/impress/src/features/docs/doc-share/components/SearchUserRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const SearchUserRow = ({
2121
alwaysShowRight = false,
2222
isInvitation = false,
2323
}: Props) => {
24-
const hasFullName = user.full_name != null && user.full_name !== '';
24+
const hasFullName = !!user.full_name;
2525
const { spacingsTokens, colorsTokens } = useCunninghamTheme();
2626

2727
return (

0 commit comments

Comments
 (0)