🚸(frontend) prevent duplicate invite user row in DocShareModal
Modify the DocShareModal to avoid showing the invite user row when the email already exists in the search results, preventing redundant invite options
This commit is contained in:
committed by
Anthony LC
parent
3b151cf580
commit
9b95a9c551
@@ -137,17 +137,20 @@ export const DocShareModal = ({ doc, onClose }: Props) => {
|
||||
short_name: '',
|
||||
};
|
||||
|
||||
const hasEmailInUsers = users.some((user) => user.email === userQuery);
|
||||
|
||||
return {
|
||||
groupName: t('Search user result'),
|
||||
elements: users,
|
||||
endActions: isEmail
|
||||
? [
|
||||
{
|
||||
content: <DocShareModalInviteUserRow user={newUser} />,
|
||||
onSelect: () => void onSelect(newUser),
|
||||
},
|
||||
]
|
||||
: undefined,
|
||||
endActions:
|
||||
isEmail && !hasEmailInUsers
|
||||
? [
|
||||
{
|
||||
content: <DocShareModalInviteUserRow user={newUser} />,
|
||||
onSelect: () => void onSelect(newUser),
|
||||
},
|
||||
]
|
||||
: undefined,
|
||||
};
|
||||
}, [searchUsersQuery.data, t, userQuery]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user