Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow system account chat to be listed in LHN, fix chat icons #41290

Merged
merged 15 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix report welcome message and details name
  • Loading branch information
NikkiWines committed Jun 1, 2024
commit a02b8de88a32ecbe9174c1127d3a552a0ccda6cd
2 changes: 1 addition & 1 deletion src/components/ReportWelcomeText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
5 changes: 2 additions & 3 deletions src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
12 changes: 8 additions & 4 deletions src/pages/ReportDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -197,6 +200,7 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD
return items;
}, [
isSelfDM,
isSystemChat,
isGroupDMChat,
isArchivedRoom,
isGroupChat,
Expand Down
Loading