Skip to content

Commit

Permalink
Fix how userId fallback is used on username
Browse files Browse the repository at this point in the history
  • Loading branch information
tnagorra committed Oct 28, 2024
1 parent 7ba2b5f commit 5faf645
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ function ItemSelectInput<Name extends string>(props: ItemSelectInputProps<Name>)
() => ([
...(usersData?.map((user) => ({
id: user.userId,
name: (isFalsyString(user.username) ? user.userId : user.username) ?? 'Unknown',
name: (isFalsyString(user.username) ? user.userId : user.username),
type: 'user' as const,
})) ?? []),
...(userGroupsData?.map((userGroup) => ({
Expand Down
4 changes: 2 additions & 2 deletions community-dashboard/app/views/UserDashboard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useMemo } from 'react';
import { gql, useQuery } from '@apollo/client';
import { encodeDate, isDefined, isNotDefined } from '@togglecorp/fujs';
import { encodeDate, isDefined, isFalsyString } from '@togglecorp/fujs';
import { useParams, generatePath, Link } from 'react-router-dom';

import useUrlState from '#hooks/useUrlState';
Expand Down Expand Up @@ -184,7 +184,7 @@ function UserDashboard(props: Props) {
// NOTE: OSM user does not have username stored
const userName = useMemo(() => {
if (isDefined(userStats) && isDefined(userStats.user)) {
return isNotDefined(userStats.user.username)
return isFalsyString(userStats.user.username)
? userStats.user.userId
: userStats.user.username;
}
Expand Down

0 comments on commit 5faf645

Please sign in to comment.