Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show deleted messages with a strike-through when offline #10780

Merged
merged 4 commits into from
Sep 2, 2022
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
7 changes: 3 additions & 4 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: '',
}],
},
};

Expand Down
9 changes: 8 additions & 1 deletion src/pages/home/report/ReportActionItemFragment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -69,6 +75,7 @@ const defaultProps = {
isSingleLine: false,
tooltipText: '',
source: '',
style: [],
};

const ReportActionItemFragment = (props) => {
Expand Down Expand Up @@ -119,7 +126,7 @@ const ReportActionItemFragment = (props) => {
<Text
family="EMOJI_TEXT_FONT"
selectable={!canUseTouchScreen() || !props.isSmallScreenWidth}
style={[EmojiUtils.containsOnlyEmojis(text) ? styles.onlyEmojisText : undefined, styles.ltr]}
style={[EmojiUtils.containsOnlyEmojis(text) ? styles.onlyEmojisText : undefined, styles.ltr, ...props.style]}
>
{StyleUtils.convertToLTR(Str.htmlDecode(text))}
{props.fragment.isEdited && (
Expand Down
1 change: 1 addition & 0 deletions src/pages/home/report/ReportActionItemMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const ReportActionItemMessage = (props) => {
attachmentInfo={props.action.attachmentInfo}
source={lodashGet(props.action, 'originalMessage.source')}
loading={props.action.isLoading}
style={props.style}
/>
))}
</View>
Expand Down