Skip to content

Commit b92dd5a

Browse files
committed
Simple dual name logic
1 parent 461fb5a commit b92dd5a

4 files changed

Lines changed: 17 additions & 3 deletions

File tree

src/pages/home/report/ReportActionItemFragment.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ type ReportActionItemFragmentProps = {
6666
actionName?: ReportActionName;
6767

6868
moderationDecision?: DecisionName;
69+
70+
/** Whether the fragment should show a tooltip */
71+
shouldShowTooltip?: boolean;
6972
};
7073

7174
const MUTED_ACTIONS = [
@@ -96,6 +99,7 @@ function ReportActionItemFragment({
9699
isFragmentContainingDisplayName = false,
97100
displayAsGroup = false,
98101
moderationDecision,
102+
shouldShowTooltip = true,
99103
}: ReportActionItemFragmentProps) {
100104
const styles = useThemeStyles();
101105
const {isOffline} = useNetwork();
@@ -172,6 +176,7 @@ function ReportActionItemFragment({
172176
fragmentText={fragment.text}
173177
actorIcon={actorIcon}
174178
isSingleLine={isSingleLine}
179+
shouldShowTooltip={shouldShowTooltip}
175180
/>
176181
);
177182
}

src/pages/home/report/ReportActionItemMessageHeaderSender/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import useThemeStyles from '@hooks/useThemeStyles';
55
import * as EmojiUtils from '@libs/EmojiUtils';
66
import type ReportActionItemMessageHeaderSenderProps from './types';
77

8-
function ReportActionItemMessageHeaderSender({fragmentText, accountID, delegateAccountID, actorIcon, isSingleLine}: ReportActionItemMessageHeaderSenderProps) {
8+
function ReportActionItemMessageHeaderSender({fragmentText, accountID, delegateAccountID, actorIcon, isSingleLine, shouldShowTooltip}: ReportActionItemMessageHeaderSenderProps) {
99
const styles = useThemeStyles();
1010
const processedTextArray = useMemo(() => EmojiUtils.splitTextWithEmojis(fragmentText), [fragmentText]);
1111

@@ -14,6 +14,7 @@ function ReportActionItemMessageHeaderSender({fragmentText, accountID, delegateA
1414
accountID={accountID}
1515
delegateAccountID={delegateAccountID}
1616
icon={actorIcon}
17+
shouldRender={shouldShowTooltip}
1718
>
1819
<Text
1920
numberOfLines={isSingleLine ? 1 : undefined}

src/pages/home/report/ReportActionItemMessageHeaderSender/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ type ReportActionItemMessageHeaderSenderProps = {
1515

1616
/** Actor icon */
1717
actorIcon?: OnyxCommon.Icon;
18+
19+
/** Whether the fragment should show a tooltip */
20+
shouldShowTooltip?: boolean;
1821
};
1922

2023
export default ReportActionItemMessageHeaderSenderProps;

src/pages/home/report/ReportActionItemSingle.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,18 @@ function ReportActionItemSingle({
200200
id: avatarId,
201201
};
202202

203+
const showMultipleUserAvatarPattern = displayAllActors && !shouldShowSubscriptAvatar;
204+
205+
const headingText = showMultipleUserAvatarPattern ? `${icon.name} & ${secondaryAvatar.name}` : displayName;
206+
203207
// Since the display name for a report action message is delivered with the report history as an array of fragments
204208
// we'll need to take the displayName from personal details and have it be in the same format for now. Eventually,
205209
// we should stop referring to the report history items entirely for this information.
206-
const personArray = displayName
210+
const personArray = headingText
207211
? [
208212
{
209213
type: 'TEXT',
210-
text: displayName,
214+
text: headingText,
211215
},
212216
]
213217
: action?.person;
@@ -324,6 +328,7 @@ function ReportActionItemSingle({
324328
isSingleLine
325329
actorIcon={icon}
326330
moderationDecision={getReportActionMessage(action)?.moderationDecision?.decision}
331+
shouldShowTooltip={!showMultipleUserAvatarPattern}
327332
/>
328333
))}
329334
</PressableWithoutFeedback>

0 commit comments

Comments
 (0)