diff --git a/src/CONST.ts b/src/CONST.ts index 8e356be6df29..d59f32f3c3ce 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -55,6 +55,7 @@ const chatTypes = { POLICY_ROOM: 'policyRoom', POLICY_EXPENSE_CHAT: 'policyExpenseChat', SELF_DM: 'selfDM', + SYSTEM_DM: 'system', } as const; // Explicit type annotation is required diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index 8166036e8e17..7696615e3138 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -1724,7 +1724,7 @@ function getOptions( allPersonalDetailsOptions = lodashOrderBy(allPersonalDetailsOptions, [(personalDetail) => personalDetail.text?.toLowerCase()], 'asc'); } - const optionsToExclude: Option[] = [{login: CONST.EMAIL.NOTIFICATIONS}]; + const optionsToExclude: Option[] = []; // If we're including selected options from the search results, we only want to exclude them if the search input is empty // This is because on certain pages, we show the selected options at the top when the search input is empty @@ -1753,11 +1753,6 @@ function getOptions( break; } - // Skip notifications@expensify.com - if (reportOption.login === CONST.EMAIL.NOTIFICATIONS) { - continue; - } - const isCurrentUserOwnedPolicyExpenseChatThatCouldShow = reportOption.isPolicyExpenseChat && reportOption.ownerAccountID === currentUserAccountID && includeOwnedWorkspaceChats && !reportOption.isArchivedRoom; diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 764105f8c175..f81520ac0e3b 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -973,6 +973,10 @@ function isSelfDM(report: OnyxEntry): boolean { return getChatType(report) === CONST.REPORT.CHAT_TYPE.SELF_DM; } +function isSystemDM(report: OnyxEntry): boolean { + return getChatType(report) === CONST.REPORT.CHAT_TYPE.SYSTEM_DM; +} + function isGroupChat(report: OnyxEntry | Partial): boolean { return getChatType(report) === CONST.REPORT.CHAT_TYPE.GROUP; } @@ -1944,6 +1948,10 @@ function getIcons( return getIconsForParticipants([currentUserAccountID ?? 0], personalDetails); } + if (isSystemDM(report)) { + return getIconsForParticipants([CONST.ACCOUNT_ID.NOTIFICATIONS ?? 0], personalDetails); + } + if (isGroupChat(report)) { const groupChatIcon = { // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing @@ -3039,6 +3047,10 @@ function getReportName(report: OnyxEntry, policy: OnyxEntry = nu formattedName = getDisplayNameForParticipant(currentUserAccountID, undefined, undefined, true); } + if (isSystemDM(report)) { + formattedName = getDisplayNameForParticipant(CONST.ACCOUNT_ID.NOTIFICATIONS); + } + if (formattedName) { return formattedName; } @@ -4804,8 +4816,6 @@ function shouldReportBeInOptionList({ report?.reportName === undefined || // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing report?.isHidden || - // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - report?.participantAccountIDs?.includes(CONST.ACCOUNT_ID.NOTIFICATIONS) || (report?.participantAccountIDs?.length === 0 && !isChatThread(report) && !isPublicRoom(report) && @@ -6408,6 +6418,7 @@ export { isReportParticipant, isSelfDM, isSettled, + isSystemDM, isTaskReport, isThread, isThreadFirstChat,