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
8 changes: 5 additions & 3 deletions src/components/ReportActionItem/ReportPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const ReportPreview = (props) => {
const managerName = ReportUtils.isPolicyExpenseChat(props.chatReport) ? ReportUtils.getPolicyName(props.chatReport) : ReportUtils.getDisplayNameForParticipant(managerEmail, true);
const isCurrentUserManager = managerEmail === lodashGet(props.session, 'email', null);
return (
<View style={[styles.chatItemMessage, styles.mt4]}>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi ✋ Coming from #22797

We must maintain the top margin when previewing with the user details avatar. Instead of removing this style, we should pass a new props style 8px margin from ReportActionItem based on the message not grouped with the previous message.

<View style={[styles.chatItemMessage]}>
{_.map(props.action.message, (message, index) => (
<Pressable
key={`ReportPreview-${props.action.reportActionID}-${index}`}
Expand All @@ -114,12 +114,14 @@ const ReportPreview = (props) => {
>
<View style={[styles.flexShrink1]}>
{props.iouReport.hasOutstandingIOU ? (
<Text style={[styles.chatItemMessage, styles.cursorPointer]}>
<Text style={[styles.chatItemMessage, styles.cursorPointer, styles.colorMuted]}>
{lodashGet(message, 'html', props.translate('iou.payerOwesAmount', {payer: managerName, amount: reportAmount}))}
</Text>
) : (
<View style={[styles.flexRow]}>
<Text style={[styles.chatItemMessage, styles.cursorPointer]}>{lodashGet(message, 'html', props.translate('iou.payerSettled', {amount: reportAmount}))}</Text>
<Text style={[styles.chatItemMessage, styles.cursorPointer, styles.colorMuted]}>
{lodashGet(message, 'html', props.translate('iou.payerSettled', {amount: reportAmount}))}
</Text>
{!props.iouReport.hasOutstandingIOU && (
<Icon
style={[styles.ml10]}
Expand Down
13 changes: 9 additions & 4 deletions src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,16 @@ class ReportActionItem extends Component {
renderItemContent(hovered = false) {
let children;
const originalMessage = lodashGet(this.props.action, 'originalMessage', {});

// IOUDetails only exists when we are sending money
const isSendingMoney = originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.PAY && _.has(originalMessage, 'IOUDetails');

// Show the IOUPreview for when request was created, bill was split or money was sent
if (
this.props.action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU &&
originalMessage &&
(originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.CREATE ||
originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.SPLIT ||
(originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.PAY && _.has(originalMessage, 'IOUDetails')))
// For the pay flow, we only want to show MoneyRequestAction when sending money. When paying, we display a regular system message
(originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.CREATE || originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.SPLIT || isSendingMoney)
) {
// There is no single iouReport for bill splits, so only 1:1 requests require an iouReportID
const iouReportID = originalMessage.IOUReportID ? originalMessage.IOUReportID.toString() : '0';
Expand Down Expand Up @@ -256,7 +259,9 @@ class ReportActionItem extends Component {
action={this.props.action}
style={[
!this.props.displayAsGroup && isAttachment ? styles.mt2 : undefined,
_.contains(_.values(CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG), this.props.action.actionName) ? styles.colorMuted : undefined,
_.contains([..._.values(CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG), CONST.REPORT.ACTIONS.TYPE.IOU], this.props.action.actionName)
? styles.colorMuted
: undefined,
]}
/>
) : (
Expand Down
5 changes: 4 additions & 1 deletion src/pages/home/report/ReportActionsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ const ReportActionsList = (props) => {
action={reportAction}
displayAsGroup={ReportActionsUtils.isConsecutiveActionMadeByPreviousActor(sortedReportActions, index)}
shouldDisplayNewMarker={shouldDisplayNewMarker}
shouldShowSubscriptAvatar={ReportUtils.isPolicyExpenseChat(report) && reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.IOU}
shouldShowSubscriptAvatar={
(ReportUtils.isPolicyExpenseChat(report) || ReportUtils.isExpenseReport(report)) &&
_.contains([CONST.REPORT.ACTIONS.TYPE.IOU, CONST.REPORT.ACTIONS.TYPE.REPORTPREVIEW], reportAction.actionName)
}
isMostRecentIOUReportAction={reportAction.reportActionID === mostRecentIOUReportActionID}
hasOutstandingIOU={hasOutstandingIOU}
index={index}
Expand Down