From 13edc9441754e9697a3528edf011b2e4e693dad7 Mon Sep 17 00:00:00 2001 From: Pavlo Tsimura Date: Wed, 3 Jan 2024 00:05:29 +0100 Subject: [PATCH] Add an explanatory comment for an early "Hidden" return --- src/libs/ReportUtils.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 52fa17e7aac3..457eb6ef3982 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -1439,9 +1439,11 @@ function getDisplayNameForParticipant(accountID?: number, shouldUseShortForm = f return formattedLogin; } - const longName = PersonalDetailsUtils.getDisplayNameOrDefault(personalDetails, formattedLogin, false); - if (!longName && shouldFallbackToHidden) { - return Localize.translateLocal('common.hidden'); + const longName = PersonalDetailsUtils.getDisplayNameOrDefault(personalDetails, formattedLogin, shouldFallbackToHidden); + + // If the user's personal details (first name) should be hidden, make sure we return "hidden" instead of the short name + if (shouldFallbackToHidden && longName === Localize.translateLocal('common.hidden')) { + return longName; } const shortName = personalDetails.firstName ? personalDetails.firstName : longName;