Merge branch 'fix-username-lookup-case' into 'develop'

useAccountLookup, useGroupLookup: make lookup case insensitive

Closes #1460

See merge request soapbox-pub/soapbox!2597
This commit is contained in:
Alex Gleason 2023-07-06 17:33:56 +00:00
commit 23247802b3
2 changed files with 2 additions and 2 deletions

View File

@ -22,7 +22,7 @@ function useAccountLookup(acct: string | undefined, opts: UseAccountLookupOpts =
const { entity: account, isUnauthorized, ...result } = useEntityLookup<Account>(
Entities.ACCOUNTS,
(account) => account.acct === acct,
(account) => account.acct.toLowerCase() === acct?.toLowerCase(),
() => api.get(`/api/v1/accounts/lookup?acct=${acct}`),
{ schema: accountSchema, enabled: !!acct },
);

View File

@ -16,7 +16,7 @@ function useGroupLookup(slug: string) {
const { entity: group, isUnauthorized, ...result } = useEntityLookup(
Entities.GROUPS,
(group) => group.slug === slug,
(group) => group.slug.toLowerCase() === slug.toLowerCase(),
() => api.get(`/api/v1/groups/lookup?name=${slug}`),
{ schema: groupSchema, enabled: features.groups && !!slug },
);