Skip to content

Commit e2642cc

Browse files
committed
fix: show requester name when empty string alias
- When the user removes their alias, an empty string is returned by the api. Our check previously only accounted for undefined values to fallback to the name.
1 parent 13f7f9a commit e2642cc

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

assets/request-list-bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/modules/request-list/components/requests-table/requests-table-row/RequestsTableCell.test.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,15 @@ describe("RequestsTableCell", () => {
180180
screen.getAllByText("Baby", { exact: false })[0]
181181
).toBeInTheDocument();
182182
});
183+
184+
test("renders requester name when alias is empty", () => {
185+
const userWithEmptyAlias = { ...mockAliasUser, alias: "" };
186+
renderCell({ identifier: "requester", user: userWithEmptyAlias });
187+
188+
expect(
189+
screen.getAllByText("Paolo", { exact: false })[0]
190+
).toBeInTheDocument();
191+
});
183192
});
184193

185194
describe("Custom field rendering", () => {

src/modules/request-list/components/requests-table/requests-table-row/RequestsTableCell.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,10 @@ The same applies for the description. */
179179
}
180180

181181
if (identifier === "requester") {
182-
const nameOrAlias = user?.alias === undefined ? user?.name : user?.alias;
182+
const nameOrAlias =
183+
user?.alias === undefined || user?.alias === ""
184+
? user?.name
185+
: user?.alias;
183186

184187
return (
185188
<TruncatedTableCell identifier={identifier}>

0 commit comments

Comments
 (0)