From 1cbeb47110a45fe75b3df7b6c1f6d0d32cc72477 Mon Sep 17 00:00:00 2001 From: Francois Laithier Date: Mon, 29 Apr 2024 18:08:47 -0700 Subject: [PATCH 1/9] Allow system account chat to be listed in LHN, fix chat icons --- src/components/ReportWelcomeText.tsx | 8 +++++++- src/languages/en.ts | 1 + src/languages/es.ts | 1 + src/libs/ReportUtils.ts | 12 +++++++++--- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/components/ReportWelcomeText.tsx b/src/components/ReportWelcomeText.tsx index 5b2ba1720ab0..6ac5b16374ff 100644 --- a/src/components/ReportWelcomeText.tsx +++ b/src/components/ReportWelcomeText.tsx @@ -40,7 +40,8 @@ function ReportWelcomeText({report, policy, personalDetails}: ReportWelcomeTextP const isChatRoom = ReportUtils.isChatRoom(report); const isSelfDM = ReportUtils.isSelfDM(report); const isInvoiceRoom = ReportUtils.isInvoiceRoom(report); - const isDefault = !(isChatRoom || isPolicyExpenseChat || isSelfDM || isInvoiceRoom); + const isSystemDM = ReportUtils.isSystemChat(report); + const isDefault = !(isChatRoom || isPolicyExpenseChat || isSelfDM || isInvoiceRoom || isSystemDM); const participantAccountIDs = report?.participantAccountIDs ?? []; const isMultipleParticipant = participantAccountIDs.length > 1; const displayNamesWithTooltips = ReportUtils.getDisplayNamesWithTooltips(OptionsListUtils.getPersonalDetailsForAccountIDs(participantAccountIDs, personalDetails), isMultipleParticipant); @@ -142,6 +143,11 @@ function ReportWelcomeText({report, policy, personalDetails}: ReportWelcomeTextP {translate('reportActionsView.beginningOfChatHistorySelfDM')} )} + {isSystemDM && ( + + {translate('reportActionsView.beginningOfChatHistorySystemDM')} + + )} {isDefault && ( {translate('reportActionsView.beginningOfChatHistory')} diff --git a/src/languages/en.ts b/src/languages/en.ts index df70e836d04c..961904cdd047 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -511,6 +511,7 @@ export default { beginningOfChatHistoryPolicyExpenseChatPartTwo: ' and ', beginningOfChatHistoryPolicyExpenseChatPartThree: ' starts here! šŸŽ‰ This is the place to chat, submit expenses and settle up.', beginningOfChatHistorySelfDM: 'This is your personal space. Use it for notes, tasks, drafts, and reminders.', + beginningOfChatHistorySystemDM: "Welcome! Let's get you set up.", chatWithAccountManager: 'Chat with your account manager here', sayHello: 'Say hello!', yourSpace: 'Your space', diff --git a/src/languages/es.ts b/src/languages/es.ts index e86b50e74c62..94d23a62b8c2 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -504,6 +504,7 @@ export default { beginningOfChatHistoryPolicyExpenseChatPartTwo: ' y ', beginningOfChatHistoryPolicyExpenseChatPartThree: ' empieza aquĆ­! šŸŽ‰ Este es el lugar donde chatear y presentar o pagar gastos.', beginningOfChatHistorySelfDM: 'Este es tu espacio personal. ƚsalo para notas, tareas, borradores y recordatorios.', + beginningOfChatHistorySystemDM: "Welcome! Let's get you set up.", chatWithAccountManager: 'Chatea con tu gestor de cuenta aquĆ­', sayHello: 'Ā”Saluda!', yourSpace: 'Tu espacio', diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 038357c86cbc..d4e73ae850bd 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -1972,6 +1972,10 @@ function getIcons( return getIconsForParticipants([currentUserAccountID ?? 0], personalDetails); } + if (isSystemChat(report)) { + return getIconsForParticipants([CONST.ACCOUNT_ID.NOTIFICATIONS ?? 0], personalDetails); + } + if (isGroupChat(report)) { const groupChatIcon = { // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing @@ -3123,6 +3127,10 @@ function getReportName(report: OnyxEntry, policy: OnyxEntry = nu formattedName = getDisplayNameForParticipant(currentUserAccountID, undefined, undefined, true); } + if (isSystemChat(report)) { + formattedName = getDisplayNameForParticipant(CONST.ACCOUNT_ID.NOTIFICATIONS); + } + if (isInvoiceRoom(report)) { formattedName = getInvoicesChatName(report); } @@ -4973,8 +4981,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) && @@ -5382,7 +5388,7 @@ function isGroupChatAdmin(report: OnyxEntry, accountID: number) { */ function getMoneyRequestOptions(report: OnyxEntry, policy: OnyxEntry, reportParticipants: number[], canUseTrackExpense = true, filterDeprecatedTypes = false): IOUType[] { // In any thread or task report, we do not allow any new expenses yet - if (isChatThread(report) || isTaskReport(report) || (!canUseTrackExpense && isSelfDM(report)) || isInvoiceRoom(report) || isInvoiceReport(report)) { + if (isChatThread(report) || isTaskReport(report) || (!canUseTrackExpense && isSelfDM(report)) || isInvoiceRoom(report) || isInvoiceReport(report) || isSystemChat(report)) { return []; } From feb523cd4a234096977ceee8c69677a38e9674fb Mon Sep 17 00:00:00 2001 From: Francois Laithier Date: Tue, 30 Apr 2024 13:18:58 -0700 Subject: [PATCH 2/9] Fix spanish copy, fix welcome title, hide Join button --- src/components/ReportWelcomeText.tsx | 6 +++++- src/languages/es.ts | 2 +- src/pages/home/HeaderView.tsx | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/ReportWelcomeText.tsx b/src/components/ReportWelcomeText.tsx index 6ac5b16374ff..699f44abfbe4 100644 --- a/src/components/ReportWelcomeText.tsx +++ b/src/components/ReportWelcomeText.tsx @@ -76,8 +76,12 @@ function ReportWelcomeText({report, policy, personalDetails}: ReportWelcomeTextP return translate('reportActionsView.yourSpace'); } + if (isSystemDM) { + return reportName; + } + return translate('reportActionsView.sayHello'); - }, [isChatRoom, isInvoiceRoom, isSelfDM, translate, reportName]); + }, [isChatRoom, isInvoiceRoom, isSelfDM, isSystemDM, translate, reportName]); return ( <> diff --git a/src/languages/es.ts b/src/languages/es.ts index 94d23a62b8c2..a19ce8c570fd 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -504,7 +504,7 @@ export default { beginningOfChatHistoryPolicyExpenseChatPartTwo: ' y ', beginningOfChatHistoryPolicyExpenseChatPartThree: ' empieza aquĆ­! šŸŽ‰ Este es el lugar donde chatear y presentar o pagar gastos.', beginningOfChatHistorySelfDM: 'Este es tu espacio personal. ƚsalo para notas, tareas, borradores y recordatorios.', - beginningOfChatHistorySystemDM: "Welcome! Let's get you set up.", + beginningOfChatHistorySystemDM: 'Ā”Bienvenido! Vamos a configurar tu cuenta.', chatWithAccountManager: 'Chatea con tu gestor de cuenta aquĆ­', sayHello: 'Ā”Saluda!', yourSpace: 'Tu espacio', diff --git a/src/pages/home/HeaderView.tsx b/src/pages/home/HeaderView.tsx index 4295f1f0c46a..5d7668d7f13e 100644 --- a/src/pages/home/HeaderView.tsx +++ b/src/pages/home/HeaderView.tsx @@ -88,6 +88,7 @@ function HeaderView({ const theme = useTheme(); const styles = useThemeStyles(); const isSelfDM = ReportUtils.isSelfDM(report); + const isSystemDM = ReportUtils.isSystemChat(report); const isGroupChat = ReportUtils.isGroupChat(report) || ReportUtils.isDeprecatedGroupDM(report); // Currently, currentUser is not included in participantAccountIDs, so for selfDM, we need to add the currentUser as participants. const participants = isSelfDM ? [session?.accountID ?? -1] : (report?.participantAccountIDs ?? []).slice(0, 5); @@ -157,7 +158,7 @@ function HeaderView({ Report.updateNotificationPreference(reportID, report.notificationPreference, CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, false, report.parentReportID, report.parentReportActionID), ); - const canJoinOrLeave = !isSelfDM && !isGroupChat && (isChatThread || isUserCreatedPolicyRoom || canLeaveRoom || canLeavePolicyExpenseChat); + const canJoinOrLeave = !isSelfDM && !isGroupChat && !isSystemDM && (isChatThread || isUserCreatedPolicyRoom || canLeaveRoom || canLeavePolicyExpenseChat); const canJoin = canJoinOrLeave && !isWhisperAction && report.notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN; const canLeave = canJoinOrLeave && ((isChatThread && !!report.notificationPreference?.length) || isUserCreatedPolicyRoom || canLeaveRoom || canLeavePolicyExpenseChat); if (canJoin) { From 087bae4ec351e8839afaf30664b8c9caed9f9857 Mon Sep 17 00:00:00 2001 From: NikkiWines Date: Wed, 1 May 2024 17:16:23 -0700 Subject: [PATCH 3/9] don't exclude notifications@ --- src/libs/OptionsListUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index 8166036e8e17..fcfbdc0ec914 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 From 7f2c9db49e52e8ab13ce1b2f1e66640b3fe1d2ab Mon Sep 17 00:00:00 2001 From: NikkiWines Date: Fri, 3 May 2024 18:28:38 -0700 Subject: [PATCH 4/9] show system chat in LHN but don't focus on it when signing up --- src/libs/ReportUtils.ts | 15 +++++++++++++-- src/libs/SidebarUtils.ts | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index c78e942b4e39..bc3755114af4 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -1167,6 +1167,8 @@ function findLastAccessedReport( } if (isFirstTimeNewExpensifyUser) { + // Filter out the systemChat report from the reports list, as we don't want to drop the user into that report over Concierge when they first log in + sortedReports = sortedReports.filter((report) => !isSystemChat(report)) ?? []; if (sortedReports.length === 1) { return sortedReports[0]; } @@ -1174,6 +1176,13 @@ function findLastAccessedReport( return adminReport ?? sortedReports.find((report) => !isConciergeChatReport(report)) ?? null; } + // If we only have two reports and one of them is the system chat, filter it out so we don't + // overwrite showing the concierge chat + let hasSystemChat = sortedReports.find((report) => isSystemChat(report)) ?? false; + if (sortedReports.length === 2 && hasSystemChat) { + sortedReports = sortedReports.filter((report) => !isSystemChat(report)) ?? []; + } + return adminReport ?? sortedReports.at(-1) ?? null; } @@ -5011,11 +5020,13 @@ function shouldReportBeInOptionList({ !isMoneyRequestReport(report) && !isTaskReport(report) && !isSelfDM(report) && + !isSystemChat(report) && !isGroupChat(report) && !isInvoiceRoom(report)) ) { return false; } + if (!canAccessReport(report, policies, betas)) { return false; } @@ -5077,8 +5088,8 @@ function shouldReportBeInOptionList({ return true; } - // Hide chats between two users that haven't been commented on from the LNH - if (excludeEmptyChats && isEmptyChat && isChatReport(report) && !isChatRoom(report) && !isPolicyExpenseChat(report) && canHideReport) { + // Hide chats between two users that haven't been commented on from the LNH and aren't system DMs + if (excludeEmptyChats && isEmptyChat && isChatReport(report) && !isChatRoom(report) && !isPolicyExpenseChat(report) && !isSystemChat(report) && canHideReport) { return false; } diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 74fab75dcc18..2d84f496181d 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -89,7 +89,7 @@ function getOrderedReportIDs( const isFocused = report.reportID === currentReportId; const allReportErrors = OptionsListUtils.getAllReportErrors(report, reportActions) ?? {}; const hasErrorsOtherThanFailedReceipt = doesReportHaveViolations || Object.values(allReportErrors).some((error) => error?.[0] !== 'report.genericSmartscanFailureMessage'); - const shouldOverrideHidden = hasErrorsOtherThanFailedReceipt || isFocused || report.isPinned; + const shouldOverrideHidden = hasErrorsOtherThanFailedReceipt || isFocused || report.isPinned || ReportUtils.isSystemChat(report); if (isHidden && !shouldOverrideHidden) { return false; } From 926d7af225d72feb3b8a958a1fc97fa99ee563fb Mon Sep 17 00:00:00 2001 From: NikkiWines Date: Wed, 29 May 2024 17:12:30 -0700 Subject: [PATCH 5/9] lint/type/prettier --- src/libs/ReportUtils.ts | 4 ++-- src/libs/SidebarUtils.ts | 2 ++ src/pages/home/HeaderView.tsx | 1 - 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index f094dc6cd892..5724cdc5059e 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -81,7 +81,7 @@ import * as ReportActionsUtils from './ReportActionsUtils'; import StringUtils from './StringUtils'; import * as TransactionUtils from './TransactionUtils'; import * as Url from './Url'; -import type * as UserUtils from './UserUtils'; +import * as UserUtils from './UserUtils'; type AvatarRange = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18; @@ -1210,7 +1210,7 @@ function findLastAccessedReport( // If we only have two reports and one of them is the system chat, filter it out so we don't // overwrite showing the concierge chat - let hasSystemChat = sortedReports.find((report) => isSystemChat(report)) ?? false; + const hasSystemChat = sortedReports.find((report) => isSystemChat(report)) ?? false; if (sortedReports.length === 2 && hasSystemChat) { sortedReports = sortedReports.filter((report) => !isSystemChat(report)) ?? []; } diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 2b91e28dc6f2..a16c491977b7 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -98,6 +98,8 @@ function getOrderedReportIDs( const isFocused = report.reportID === currentReportId; const allReportErrors = OptionsListUtils.getAllReportErrors(report, reportActions) ?? {}; const hasErrorsOtherThanFailedReceipt = doesReportHaveViolations || Object.values(allReportErrors).some((error) => error?.[0] !== 'report.genericSmartscanFailureMessage'); + + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const shouldOverrideHidden = hasErrorsOtherThanFailedReceipt || isFocused || report.isPinned || ReportUtils.isSystemChat(report); if (isHidden && !shouldOverrideHidden) { return false; diff --git a/src/pages/home/HeaderView.tsx b/src/pages/home/HeaderView.tsx index b07a4625efc4..b16fb86f9b21 100644 --- a/src/pages/home/HeaderView.tsx +++ b/src/pages/home/HeaderView.tsx @@ -88,7 +88,6 @@ function HeaderView({ const theme = useTheme(); const styles = useThemeStyles(); const isSelfDM = ReportUtils.isSelfDM(report); - const isSystemDM = ReportUtils.isSystemChat(report); const isGroupChat = ReportUtils.isGroupChat(report) || ReportUtils.isDeprecatedGroupDM(report); const isOneOnOneChat = ReportUtils.isOneOnOneChat(report); From 6158dd6f108bc2d33057a44e3acae0ab69ac7d81 Mon Sep 17 00:00:00 2001 From: NikkiWines Date: Thu, 30 May 2024 13:36:11 -0700 Subject: [PATCH 6/9] fix showing participants for system dm --- src/components/ReportWelcomeText.tsx | 2 +- src/pages/home/HeaderView.tsx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/ReportWelcomeText.tsx b/src/components/ReportWelcomeText.tsx index e27ade6e543e..2f7914396b50 100644 --- a/src/components/ReportWelcomeText.tsx +++ b/src/components/ReportWelcomeText.tsx @@ -44,7 +44,7 @@ function ReportWelcomeText({report, policy, personalDetails}: ReportWelcomeTextP const isDefault = !(isChatRoom || isPolicyExpenseChat || isSelfDM || isInvoiceRoom); const participantAccountIDs = Object.keys(report?.participants ?? {}) .map(Number) - .filter((accountID) => accountID !== session?.accountID || !isOneOnOneChat); + .filter((accountID) => accountID !== session?.accountID || (!isOneOnOneChat && !isSystemDM)); const isMultipleParticipant = participantAccountIDs.length > 1; const displayNamesWithTooltips = ReportUtils.getDisplayNamesWithTooltips(OptionsListUtils.getPersonalDetailsForAccountIDs(participantAccountIDs, personalDetails), isMultipleParticipant); const isUserPolicyAdmin = PolicyUtils.isPolicyAdmin(policy); diff --git a/src/pages/home/HeaderView.tsx b/src/pages/home/HeaderView.tsx index b16fb86f9b21..70597a25ceb3 100644 --- a/src/pages/home/HeaderView.tsx +++ b/src/pages/home/HeaderView.tsx @@ -90,11 +90,12 @@ function HeaderView({ const isSelfDM = ReportUtils.isSelfDM(report); const isGroupChat = ReportUtils.isGroupChat(report) || ReportUtils.isDeprecatedGroupDM(report); const isOneOnOneChat = ReportUtils.isOneOnOneChat(report); + const isSystemChat = ReportUtils.isSystemChat(report); // For 1:1 chat, we don't want to include currentUser as participants in order to not mark 1:1 chats as having multiple participants const participants = Object.keys(report?.participants ?? {}) .map(Number) - .filter((accountID) => accountID !== session?.accountID || !isOneOnOneChat) + .filter((accountID) => accountID !== session?.accountID || (!isOneOnOneChat && !isSystemChat)) .slice(0, 5); const isMultipleParticipant = participants.length > 1; From 570851aeb141b78f22c3c3d2a0e089e53e2c7b5e Mon Sep 17 00:00:00 2001 From: NikkiWines Date: Thu, 30 May 2024 13:37:12 -0700 Subject: [PATCH 7/9] unify nomenclature --- src/components/ReportWelcomeText.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/ReportWelcomeText.tsx b/src/components/ReportWelcomeText.tsx index 2f7914396b50..37ff420d2093 100644 --- a/src/components/ReportWelcomeText.tsx +++ b/src/components/ReportWelcomeText.tsx @@ -40,11 +40,11 @@ function ReportWelcomeText({report, policy, personalDetails}: ReportWelcomeTextP const isSelfDM = ReportUtils.isSelfDM(report); const isInvoiceRoom = ReportUtils.isInvoiceRoom(report); const isOneOnOneChat = ReportUtils.isOneOnOneChat(report); - const isSystemDM = ReportUtils.isSystemChat(report); + const isSystemChat = ReportUtils.isSystemChat(report); const isDefault = !(isChatRoom || isPolicyExpenseChat || isSelfDM || isInvoiceRoom); const participantAccountIDs = Object.keys(report?.participants ?? {}) .map(Number) - .filter((accountID) => accountID !== session?.accountID || (!isOneOnOneChat && !isSystemDM)); + .filter((accountID) => accountID !== session?.accountID || (!isOneOnOneChat && !isSystemChat)); const isMultipleParticipant = participantAccountIDs.length > 1; const displayNamesWithTooltips = ReportUtils.getDisplayNamesWithTooltips(OptionsListUtils.getPersonalDetailsForAccountIDs(participantAccountIDs, personalDetails), isMultipleParticipant); const isUserPolicyAdmin = PolicyUtils.isPolicyAdmin(policy); @@ -78,12 +78,12 @@ function ReportWelcomeText({report, policy, personalDetails}: ReportWelcomeTextP return translate('reportActionsView.yourSpace'); } - if (isSystemDM) { + if (isSystemChat) { return reportName; } return translate('reportActionsView.sayHello'); - }, [isChatRoom, isInvoiceRoom, isSelfDM, isSystemDM, translate, reportName]); + }, [isChatRoom, isInvoiceRoom, isSelfDM, isSystemChat, translate, reportName]); return ( <> @@ -149,7 +149,7 @@ function ReportWelcomeText({report, policy, personalDetails}: ReportWelcomeTextP {translate('reportActionsView.beginningOfChatHistorySelfDM')} )} - {isSystemDM && ( + {isSystemChat && ( {translate('reportActionsView.beginningOfChatHistorySystemDM')} From a02b8de88a32ecbe9174c1127d3a552a0ccda6cd Mon Sep 17 00:00:00 2001 From: NikkiWines Date: Fri, 31 May 2024 17:04:41 -0700 Subject: [PATCH 8/9] fix report welcome message and details name --- src/components/ReportWelcomeText.tsx | 2 +- src/libs/SidebarUtils.ts | 5 ++--- src/pages/ReportDetailsPage.tsx | 12 ++++++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/components/ReportWelcomeText.tsx b/src/components/ReportWelcomeText.tsx index 37ff420d2093..3c8c79422965 100644 --- a/src/components/ReportWelcomeText.tsx +++ b/src/components/ReportWelcomeText.tsx @@ -41,7 +41,7 @@ function ReportWelcomeText({report, policy, personalDetails}: ReportWelcomeTextP const isInvoiceRoom = ReportUtils.isInvoiceRoom(report); const isOneOnOneChat = ReportUtils.isOneOnOneChat(report); const isSystemChat = ReportUtils.isSystemChat(report); - const isDefault = !(isChatRoom || isPolicyExpenseChat || isSelfDM || isInvoiceRoom); + const isDefault = !(isChatRoom || isPolicyExpenseChat || isSelfDM || isInvoiceRoom || isSystemChat); const participantAccountIDs = Object.keys(report?.participants ?? {}) .map(Number) .filter((accountID) => accountID !== session?.accountID || (!isOneOnOneChat && !isSystemChat)); diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index a16c491977b7..651b3185f9af 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -98,9 +98,8 @@ function getOrderedReportIDs( const isFocused = report.reportID === currentReportId; const allReportErrors = OptionsListUtils.getAllReportErrors(report, reportActions) ?? {}; const hasErrorsOtherThanFailedReceipt = doesReportHaveViolations || Object.values(allReportErrors).some((error) => error?.[0] !== 'report.genericSmartscanFailureMessage'); - - // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - const shouldOverrideHidden = hasErrorsOtherThanFailedReceipt || isFocused || report.isPinned || ReportUtils.isSystemChat(report); + const isSystemChat = ReportUtils.isSystemChat(report); + const shouldOverrideHidden = hasErrorsOtherThanFailedReceipt || isFocused || isSystemChat || report.isPinned; if (isHidden && !shouldOverrideHidden) { return false; } diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx index 79e62601548b..41cebce4af26 100644 --- a/src/pages/ReportDetailsPage.tsx +++ b/src/pages/ReportDetailsPage.tsx @@ -84,15 +84,17 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD // eslint-disable-next-line react-hooks/exhaustive-deps -- policy is a dependency because `getChatRoomSubtitle` calls `getPolicyName` which in turn retrieves the value from the `policy` value stored in Onyx const chatRoomSubtitle = useMemo(() => ReportUtils.getChatRoomSubtitle(report), [report, policy]); const parentNavigationSubtitleData = ReportUtils.getParentNavigationSubtitle(report); + const isSystemChat = useMemo(() => ReportUtils.isSystemChat(report), [report]); const isGroupChat = useMemo(() => ReportUtils.isGroupChat(report), [report]); const isThread = useMemo(() => ReportUtils.isThread(report), [report]); const participants = useMemo(() => { - if (isGroupChat) { - return ReportUtils.getParticipantAccountIDs(report.reportID ?? ''); + if (isGroupChat || isSystemChat) { + // Filter out the current user from the particpants of the systemChat + return ReportUtils.getParticipantAccountIDs(report.reportID ?? '').filter((accountID) => accountID !== session?.accountID && isSystemChat); } return ReportUtils.getVisibleChatMemberAccountIDs(report.reportID ?? ''); - }, [report, isGroupChat]); + }, [report, session, isGroupChat, isSystemChat]); // Get the active chat members by filtering out the pending members with delete action const activeChatMembers = participants.flatMap((accountID) => { @@ -144,7 +146,8 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD (isDefaultRoom && isChatThread && isPolicyEmployee) || (!isUserCreatedPolicyRoom && participants.length) || (isUserCreatedPolicyRoom && (isPolicyEmployee || (isChatThread && !ReportUtils.isPublicRoom(report))))) && - !ReportUtils.isConciergeChatReport(report) + !ReportUtils.isConciergeChatReport(report) && + !isSystemChat ) { items.push({ key: CONST.REPORT_DETAILS_MENU_ITEM.MEMBERS, @@ -197,6 +200,7 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD return items; }, [ isSelfDM, + isSystemChat, isGroupDMChat, isArchivedRoom, isGroupChat, From a794af4451b9ed9886cae0cc71ae5713e6defa9f Mon Sep 17 00:00:00 2001 From: NikkiWines Date: Fri, 31 May 2024 17:18:44 -0700 Subject: [PATCH 9/9] re-add dependency --- src/pages/ReportDetailsPage.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx index 2c2f42dc9d1c..02f97397e4cd 100644 --- a/src/pages/ReportDetailsPage.tsx +++ b/src/pages/ReportDetailsPage.tsx @@ -225,6 +225,7 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD return items; }, [ isSelfDM, + isSystemChat, isArchivedRoom, isGroupChat, isDefaultRoom,