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

Fix: (Redo) Copying the messages and marking a message in between as unread generates 'new' in the text #18684

2 changes: 1 addition & 1 deletion src/components/UnreadActionIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const UnreadActionIndicator = (props) => (
<View
accessibilityLabel={props.translate('accessibilityHints.newMessageLineIndicator')}
data-action-id={props.reportActionID}
style={styles.unreadIndicatorContainer}
style={[styles.unreadIndicatorContainer, styles.userSelectNone]}
>
<View style={styles.unreadIndicatorLine} />
<Text style={styles.unreadIndicatorText}>{props.translate('common.new')}</Text>
Expand Down
11 changes: 11 additions & 0 deletions src/libs/SelectionScraper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import render from 'dom-serializer';
import {parseDocument} from 'htmlparser2';
import _ from 'underscore';
import Str from 'expensify-common/lib/str';
import * as Localize from '../Localize';

const elementsWillBeSkipped = ['html', 'body'];
const tagAttribute = 'data-testid';
Expand Down Expand Up @@ -80,6 +81,16 @@ const getHTMLOfSelection = () => {
}
}

// Get the div housing the UnreadActionIndicator and remove it from copied content.
// As it currently stands, 'accessibilityHints.newMessageLineIndicator' is only used inside
// UnreadActionIndicator.js which is also only used in ReportActionItem.js, so this is a relatively
// safe move.
const newMessageLineIndicatorDiv = div.querySelector(`[aria-label="${Localize.translateLocal('accessibilityHints.newMessageLineIndicator')}"]`);

if (newMessageLineIndicatorDiv) {
newMessageLineIndicatorDiv.remove();
}

return div.innerHTML;
};

Expand Down