Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions src/components/SelectionList/ChatListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ function ChatListItem<TItem extends ListItem>({
index={item.index ?? 0}
isFirstVisibleReportAction={false}
shouldDisplayContextMenu={false}
shouldShowDraftMessage={false}
shouldShowSubscriptAvatar={
(isPolicyExpenseChat(report) || isInvoiceRoom(report)) &&
[
Expand Down
10 changes: 9 additions & 1 deletion src/pages/home/report/ReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ import type {ReportAction} from '@src/types/onyx';
import type {PureReportActionItemProps} from './PureReportActionItem';
import PureReportActionItem from './PureReportActionItem';

function ReportActionItem({action, report, ...props}: PureReportActionItemProps) {
type ReportActionItemProps = PureReportActionItemProps & {
/** Whether to show the draft message or not */
shouldShowDraftMessage?: boolean;
};

function ReportActionItem({action, report, shouldShowDraftMessage = true, ...props}: ReportActionItemProps) {
const reportID = report?.reportID;
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const originalReportID = useMemo(() => getOriginalReportID(reportID, action), [reportID, action]);
Expand All @@ -42,6 +47,9 @@ function ReportActionItem({action, report, ...props}: PureReportActionItemProps)
const [draftMessage] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${originalReportID}`, {
canBeMissing: true,
selector: (draftMessagesForReport) => {
if (!shouldShowDraftMessage) {
return undefined;
}
const matchingDraftMessage = draftMessagesForReport?.[action.reportActionID];
return typeof matchingDraftMessage === 'string' ? matchingDraftMessage : matchingDraftMessage?.message;
},
Expand Down