Skip to content

Commit

Permalink
refactor: add isConciergeChat property to OptionData and check for it
Browse files Browse the repository at this point in the history
  • Loading branch information
pac-guerreiro committed Jul 11, 2024
1 parent 16dd7a2 commit 79b3671
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/LHNOptionsList/OptionRowLHN.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function OptionRowLHN({reportID, isFocused = false, onSelectRow = () => {}, opti
}

const hasBrickError = optionItem.brickRoadIndicator === CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR;
const shouldShowGreenDotIndicator = !hasBrickError && ReportUtils.requiresAttentionFromCurrentUser(report, optionItem.parentReportAction);
const shouldShowGreenDotIndicator = !hasBrickError && ReportUtils.requiresAttentionFromCurrentUser(optionItem, optionItem.parentReportAction);
const textStyle = isFocused ? styles.sidebarLinkActiveText : styles.sidebarLinkText;
const textUnreadStyle = optionItem?.isUnread && optionItem.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.MUTE ? [textStyle, styles.sidebarLinkTextBold] : [textStyle];
const displayNameStyle = [styles.optionDisplayName, styles.optionDisplayNameCompact, styles.pre, textUnreadStyle, style];
Expand Down
5 changes: 3 additions & 2 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ type OptionData = {
shouldShowAmountInput?: boolean;
amountInputProps?: MoneyRequestAmountInputProps;
tabIndex?: 0 | -1;
isConciergeChat?: boolean;
} & Report;

type OnyxDataTaskAssigneeChat = {
Expand Down Expand Up @@ -7079,8 +7080,8 @@ function shouldShowMerchantColumn(transactions: Transaction[]) {
/**
* Whether the report is a system chat or concierge chat, depending on the user's account ID (used for A/B testing purposes).
*/
function isChatUsedForOnboarding(report: OnyxEntry<Report>): boolean {
return AccountUtils.isAccountIDOddNumber(currentUserAccountID ?? -1) ? isSystemChat(report) : isConciergeChatReport(report);
function isChatUsedForOnboarding(optionOrReport: OnyxEntry<Report> | OptionData): boolean {
return AccountUtils.isAccountIDOddNumber(currentUserAccountID ?? -1) ? isSystemChat(optionOrReport) : ((optionOrReport as OptionData).isConciergeChat ?? isConciergeChatReport(optionOrReport));
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ function getOptionData({
isWaitingOnBankAccount: false,
isAllowedToComment: true,
isDeletedParentAction: false,
isConciergeChat: false,
};

const participantAccountIDs = ReportUtils.getParticipantsAccountIDsForDisplay(report);
Expand Down Expand Up @@ -305,6 +306,7 @@ function getOptionData({
result.tooltipText = ReportUtils.getReportParticipantsTitle(visibleParticipantAccountIDs);
result.hasOutstandingChildTask = report.hasOutstandingChildTask;
result.hasParentAccess = report.hasParentAccess;
result.isConciergeChat = ReportUtils.isConciergeChatReport(report);

const hasMultipleParticipants = participantPersonalDetailList.length > 1 || result.isChatRoom || result.isPolicyExpenseChat || ReportUtils.isExpenseReport(report);
const subtitle = ReportUtils.getChatRoomSubtitle(report);
Expand Down

0 comments on commit 79b3671

Please sign in to comment.