From e57fc347a73deff0bd314624ddb6e51247633fc5 Mon Sep 17 00:00:00 2001
From: Huzaifa Rasheed <68777211+huzaifa-99@users.noreply.github.com>
Date: Thu, 11 May 2023 18:20:59 +0500
Subject: [PATCH 1/4] Adjust iou preview height based on description
 availability

---
 src/components/ReportActionItem/IOUPreview.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/components/ReportActionItem/IOUPreview.js b/src/components/ReportActionItem/IOUPreview.js
index 758c708e4d91..ae9c7eb93fd1 100644
--- a/src/components/ReportActionItem/IOUPreview.js
+++ b/src/components/ReportActionItem/IOUPreview.js
@@ -143,6 +143,7 @@ const IOUPreview = (props) => {
     const sessionEmail = lodashGet(props.session, 'email', null);
     const managerEmail = props.iouReport.managerEmail || '';
     const ownerEmail = props.iouReport.ownerEmail || '';
+    const requestDescription = Str.htmlDecode(lodashGet(props.action, 'originalMessage.comment', ''));
 
     // When displaying within a IOUDetailsModal we cannot guarantee that participants are included in the originalMessage data
     // Because an IOUPreview of type split can never be rendered within the IOUDetailsModal, manually building the email array is only needed for non-billSplit ious
@@ -240,7 +241,7 @@ const IOUPreview = (props) => {
                         <Text style={[styles.textLabel, styles.colorMuted]}>{props.translate('iou.pendingConversionMessage')}</Text>
                     )}
 
-                    <Text style={[styles.colorMuted]}>{Str.htmlDecode(lodashGet(props.action, 'originalMessage.comment', ''))}</Text>
+                    {requestDescription ? <Text style={[styles.colorMuted]}>{requestDescription}</Text> : ''}
 
                     {isCurrentUserManager && !props.shouldHidePayButton && props.iouReport.stateNum === CONST.REPORT.STATE_NUM.PROCESSING && (
                         <Button

From e8fb8ada102bda19eeadeec4b3e654f83a1b8f94 Mon Sep 17 00:00:00 2001
From: Huzaifa Rasheed <68777211+huzaifa-99@users.noreply.github.com>
Date: Thu, 11 May 2023 18:58:00 +0500
Subject: [PATCH 2/4] Updated variable name for better semantics

---
 src/components/ReportActionItem/IOUPreview.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/components/ReportActionItem/IOUPreview.js b/src/components/ReportActionItem/IOUPreview.js
index ae9c7eb93fd1..0396d4ca0f01 100644
--- a/src/components/ReportActionItem/IOUPreview.js
+++ b/src/components/ReportActionItem/IOUPreview.js
@@ -143,7 +143,7 @@ const IOUPreview = (props) => {
     const sessionEmail = lodashGet(props.session, 'email', null);
     const managerEmail = props.iouReport.managerEmail || '';
     const ownerEmail = props.iouReport.ownerEmail || '';
-    const requestDescription = Str.htmlDecode(lodashGet(props.action, 'originalMessage.comment', ''));
+    const comment = Str.htmlDecode(lodashGet(props.action, 'originalMessage.comment', ''));
 
     // When displaying within a IOUDetailsModal we cannot guarantee that participants are included in the originalMessage data
     // Because an IOUPreview of type split can never be rendered within the IOUDetailsModal, manually building the email array is only needed for non-billSplit ious
@@ -241,7 +241,7 @@ const IOUPreview = (props) => {
                         <Text style={[styles.textLabel, styles.colorMuted]}>{props.translate('iou.pendingConversionMessage')}</Text>
                     )}
 
-                    {requestDescription ? <Text style={[styles.colorMuted]}>{requestDescription}</Text> : ''}
+                    {_.isEmpty(comment) ? <Text style={[styles.colorMuted]}>{comment}</Text> : ''}
 
                     {isCurrentUserManager && !props.shouldHidePayButton && props.iouReport.stateNum === CONST.REPORT.STATE_NUM.PROCESSING && (
                         <Button

From 0c5ac866336fef8d8c682212541b3ee23355dce8 Mon Sep 17 00:00:00 2001
From: Huzaifa Rasheed <68777211+huzaifa-99@users.noreply.github.com>
Date: Thu, 11 May 2023 19:07:31 +0500
Subject: [PATCH 3/4] Updated conditional check

---
 src/components/ReportActionItem/IOUPreview.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/components/ReportActionItem/IOUPreview.js b/src/components/ReportActionItem/IOUPreview.js
index 0396d4ca0f01..1eb3ae17c1fc 100644
--- a/src/components/ReportActionItem/IOUPreview.js
+++ b/src/components/ReportActionItem/IOUPreview.js
@@ -143,7 +143,7 @@ const IOUPreview = (props) => {
     const sessionEmail = lodashGet(props.session, 'email', null);
     const managerEmail = props.iouReport.managerEmail || '';
     const ownerEmail = props.iouReport.ownerEmail || '';
-    const comment = Str.htmlDecode(lodashGet(props.action, 'originalMessage.comment', ''));
+    const comment = Str.htmlDecode(lodashGet(props.action, 'originalMessage.comment', '')).trim();
 
     // When displaying within a IOUDetailsModal we cannot guarantee that participants are included in the originalMessage data
     // Because an IOUPreview of type split can never be rendered within the IOUDetailsModal, manually building the email array is only needed for non-billSplit ious
@@ -241,7 +241,7 @@ const IOUPreview = (props) => {
                         <Text style={[styles.textLabel, styles.colorMuted]}>{props.translate('iou.pendingConversionMessage')}</Text>
                     )}
 
-                    {_.isEmpty(comment) ? <Text style={[styles.colorMuted]}>{comment}</Text> : ''}
+                    {!_.isEmpty(comment) && <Text style={[styles.colorMuted]}>{comment}</Text>}
 
                     {isCurrentUserManager && !props.shouldHidePayButton && props.iouReport.stateNum === CONST.REPORT.STATE_NUM.PROCESSING && (
                         <Button

From ada98d14075cfc4744cb517ef8ed6d9afb21c40a Mon Sep 17 00:00:00 2001
From: Huzaifa Rasheed <68777211+huzaifa-99@users.noreply.github.com>
Date: Sun, 14 May 2023 18:20:49 +0500
Subject: [PATCH 4/4] Added end of file line break

---
 src/components/ReportActionItem/IOUPreview.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/components/ReportActionItem/IOUPreview.js b/src/components/ReportActionItem/IOUPreview.js
index b23baa94280d..4bc60914bb4d 100644
--- a/src/components/ReportActionItem/IOUPreview.js
+++ b/src/components/ReportActionItem/IOUPreview.js
@@ -283,4 +283,4 @@ export default compose(
             key: ONYXKEYS.WALLET_TERMS,
         },
     }),
-)(IOUPreview);
\ No newline at end of file
+)(IOUPreview);
