Skip to content

Commit

Permalink
Merge pull request #41200 from neonbhai/system-footer-fixes
Browse files Browse the repository at this point in the history
(cherry picked from commit 3d06f77)
  • Loading branch information
francoisl authored and OSBotify committed Apr 29, 2024
1 parent 3c97f81 commit 5414222
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ const chatTypes = {
POLICY_ROOM: 'policyRoom',
POLICY_EXPENSE_CHAT: 'policyExpenseChat',
SELF_DM: 'selfDM',
<<<<<<< HEAD
=======
INVOICE: 'invoice',
SYSTEM: 'system',
>>>>>>> 3d06f77 (Merge pull request #41200 from neonbhai/system-footer-fixes)
} as const;

// Explicit type annotation is required
Expand Down
5 changes: 5 additions & 0 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,10 @@ function isGroupChat(report: OnyxEntry<Report> | Partial<Report>): boolean {
return getChatType(report) === CONST.REPORT.CHAT_TYPE.GROUP;
}

function isSystemChat(report: OnyxEntry<Report>): boolean {
return getChatType(report) === CONST.REPORT.CHAT_TYPE.SYSTEM;
}

/**
* Only returns true if this is our main 1:1 DM report with Concierge
*/
Expand Down Expand Up @@ -6408,6 +6412,7 @@ export {
isReportParticipant,
isSelfDM,
isSettled,
isSystemChat,
isTaskReport,
isThread,
isThreadFirstChat,
Expand Down
3 changes: 2 additions & 1 deletion src/pages/home/report/ReportFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ function ReportFooter({
const isSmallSizeLayout = windowWidth - (isSmallScreenWidth ? 0 : variables.sideBarWidth) < variables.anonymousReportFooterBreakpoint;
const hideComposer = !ReportUtils.canUserPerformWriteAction(report);
const canWriteInReport = ReportUtils.canWriteInReport(report);
const isSystemChat = ReportUtils.isSystemChat(report);

const allPersonalDetails = usePersonalDetails();

Expand Down Expand Up @@ -141,7 +142,7 @@ function ReportFooter({
/>
)}
{isArchivedRoom && <ArchivedReportFooter report={report} />}
{!canWriteInReport && <SystemChatReportFooterMessage />}
{!isAnonymousUser && !canWriteInReport && isSystemChat && <SystemChatReportFooterMessage />}
{!isSmallScreenWidth && <View style={styles.offlineIndicatorRow}>{hideComposer && <OfflineIndicator containerStyles={[styles.chatItemComposeSecondaryRow]} />}</View>}
</View>
)}
Expand Down

0 comments on commit 5414222

Please sign in to comment.