🚸(frontend) simplify invite user row logic in DocShareModal

Refactor the endActions logic to show invite user row when searching by
email, removing the unnecessary length check for users
This commit is contained in:
Nathan Panchout
2025-01-27 11:42:00 +01:00
committed by Samuel Paccoud
parent 609ff91894
commit a39990d90f
4 changed files with 78 additions and 81 deletions

View File

@@ -1,2 +0,0 @@
NEXT_PUBLIC_API_ORIGIN=
NEXT_PUBLIC_SW_DEACTIVATED=

View File

@@ -140,15 +140,14 @@ export const DocShareModal = ({ doc, onClose }: Props) => {
return {
groupName: t('Search user result'),
elements: users,
endActions:
isEmail && users.length === 0
? [
{
content: <DocShareModalInviteUserRow user={newUser} />,
onSelect: () => void onSelect(newUser),
},
]
: undefined,
endActions: isEmail
? [
{
content: <DocShareModalInviteUserRow user={newUser} />,
onSelect: () => void onSelect(newUser),
},
]
: undefined,
};
}, [searchUsersQuery.data, t, userQuery]);