From 8d008faeac557fcd3bc32b5eb221082b57511538 Mon Sep 17 00:00:00 2001 From: Paulo Vale Date: Fri, 2 Sep 2022 10:43:47 +0200 Subject: [PATCH 1/4] Show deleted messages with a strike-through when offline --- src/libs/actions/Report.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index ce448bc0ed5d..ad2dd0c54dd2 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -1103,13 +1103,12 @@ Onyx.connect({ */ function deleteReportComment(reportID, reportAction) { const sequenceNumber = reportAction.sequenceNumber; + + // We are not updating the message content here so the message can re-appear as strike-throughed + // if the user goes offline. The API will update the message content to empty strings on success. const optimisticReportActions = { [sequenceNumber]: { pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE, - message: [{ - html: '', - text: '', - }], }, }; From f95f142eed2d36b063767301a9df60ee4aafdfc1 Mon Sep 17 00:00:00 2001 From: Paulo Vale Date: Fri, 2 Sep 2022 12:36:20 +0200 Subject: [PATCH 2/4] Propagate strike-through style to reportActionFragment --- src/pages/home/report/ReportActionItemFragment.js | 3 ++- src/pages/home/report/ReportActionItemMessage.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionItemFragment.js b/src/pages/home/report/ReportActionItemFragment.js index 4d4d444ffd81..62ccf9609f43 100644 --- a/src/pages/home/report/ReportActionItemFragment.js +++ b/src/pages/home/report/ReportActionItemFragment.js @@ -69,6 +69,7 @@ const defaultProps = { isSingleLine: false, tooltipText: '', source: '', + style: [], }; const ReportActionItemFragment = (props) => { @@ -119,7 +120,7 @@ const ReportActionItemFragment = (props) => { {StyleUtils.convertToLTR(Str.htmlDecode(text))} {props.fragment.isEdited && ( diff --git a/src/pages/home/report/ReportActionItemMessage.js b/src/pages/home/report/ReportActionItemMessage.js index 9cfa1e5eb537..a066b2be34f8 100644 --- a/src/pages/home/report/ReportActionItemMessage.js +++ b/src/pages/home/report/ReportActionItemMessage.js @@ -45,6 +45,7 @@ const ReportActionItemMessage = (props) => { attachmentInfo={props.action.attachmentInfo} source={lodashGet(props.action, 'originalMessage.source')} loading={props.action.isLoading} + style={props.style} /> ))} From 10e17bafc9701b835bed89dd7a20ddff2c461618 Mon Sep 17 00:00:00 2001 From: Paulo Vale Date: Fri, 2 Sep 2022 12:44:04 +0200 Subject: [PATCH 3/4] Add style to reportActionFragment propTypes --- src/pages/home/report/reportActionFragmentPropTypes.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pages/home/report/reportActionFragmentPropTypes.js b/src/pages/home/report/reportActionFragmentPropTypes.js index 51788260a798..e009e1b1da08 100644 --- a/src/pages/home/report/reportActionFragmentPropTypes.js +++ b/src/pages/home/report/reportActionFragmentPropTypes.js @@ -25,4 +25,10 @@ export default PropTypes.shape({ // An additional avatar url - not the main avatar url but used within a message. iconUrl: PropTypes.string, + + // Additional styles to add after local styles + style: PropTypes.oneOfType([ + PropTypes.arrayOf(PropTypes.object), + PropTypes.object, + ]), }); From 47a776bf229a5704d7c4a337af3b455884cf72f1 Mon Sep 17 00:00:00 2001 From: Paulo Vale Date: Fri, 2 Sep 2022 12:53:39 +0200 Subject: [PATCH 4/4] Move propType fix to correct reportActionItemFragment file --- src/pages/home/report/ReportActionItemFragment.js | 6 ++++++ src/pages/home/report/reportActionFragmentPropTypes.js | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pages/home/report/ReportActionItemFragment.js b/src/pages/home/report/ReportActionItemFragment.js index 62ccf9609f43..3d8fdb9c6e35 100644 --- a/src/pages/home/report/ReportActionItemFragment.js +++ b/src/pages/home/report/ReportActionItemFragment.js @@ -51,6 +51,12 @@ const propTypes = { /** Should this fragment be contained in a single line? */ isSingleLine: PropTypes.bool, + // Additional styles to add after local styles + style: PropTypes.oneOfType([ + PropTypes.arrayOf(PropTypes.object), + PropTypes.object, + ]), + ...windowDimensionsPropTypes, /** localization props */ diff --git a/src/pages/home/report/reportActionFragmentPropTypes.js b/src/pages/home/report/reportActionFragmentPropTypes.js index e009e1b1da08..51788260a798 100644 --- a/src/pages/home/report/reportActionFragmentPropTypes.js +++ b/src/pages/home/report/reportActionFragmentPropTypes.js @@ -25,10 +25,4 @@ export default PropTypes.shape({ // An additional avatar url - not the main avatar url but used within a message. iconUrl: PropTypes.string, - - // Additional styles to add after local styles - style: PropTypes.oneOfType([ - PropTypes.arrayOf(PropTypes.object), - PropTypes.object, - ]), });