useAccountLookup, useGroupLookup: make lookup case insensitive

Fixes https://gitlab.com/soapbox-pub/soapbox/-/issues/1460
This commit is contained in:
Alex Gleason 2023-07-06 11:56:27 -05:00
parent c73cf80d26
commit 0e58f2b505
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
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>( const { entity: account, isUnauthorized, ...result } = useEntityLookup<Account>(
Entities.ACCOUNTS, Entities.ACCOUNTS,
(account) => account.acct === acct, (account) => account.acct.toLowerCase() === acct?.toLowerCase(),
() => api.get(`/api/v1/accounts/lookup?acct=${acct}`), () => api.get(`/api/v1/accounts/lookup?acct=${acct}`),
{ schema: accountSchema, enabled: !!acct }, { schema: accountSchema, enabled: !!acct },
); );

View File

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