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

add LHN label for deleted messages #3979

Merged
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
1 change: 1 addition & 0 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export default {
send: 'Send',
notifications: 'Notifications',
noResultsFound: 'No results found',
deletedCommentMessage: 'Comment deleted',
},
attachmentPicker: {
cameraPermissionRequired: 'Camera Permission Required',
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export default {
send: 'Enviar',
notifications: 'Notificaciones',
noResultsFound: 'No se han encontrado resultados',
deletedCommentMessage: 'Comentario borrado',
},
attachmentPicker: {
cameraPermissionRequired: 'Se necesita permiso para usar la cámara',
Expand Down
4 changes: 2 additions & 2 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ function getSimplifiedReportObject(report) {
// We convert the line-breaks in html to space ' ' before striping the tags
const lastMessageText = lodashGet(lastReportAction, ['message', 'html'], '')
.replace(/((<br[^>]*>)+)/gi, ' ')
.replace(/(<([^>]+)>)/gi, '');
.replace(/(<([^>]+)>)/gi, '') || `[${translateLocal('common.deletedCommentMessage')}]`;
Copy link
Contributor

Choose a reason for hiding this comment

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

hmmmm, can you make sure to escape any character that has a meaning in regex? Right now there's no risk, but it would be very easy for a translation to include a dot or some other character that regexes would treat differently than just a text (same below).

Copy link
Contributor Author

@dklymenk dklymenk Jul 12, 2021

Choose a reason for hiding this comment

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

I'm sorry I'm not following. The translated text is not checked against any regular expression and isn't treated as a regular expression. I'm not sure what's the concern here. Can you please rephrase it somehow maybe?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh sorry, you are right, I misread this.

const reportName = lodashGet(report, ['reportNameValuePairs', 'type']) === 'chat'
? getChatReportName(report, chatType)
: report.reportName;
Expand Down Expand Up @@ -504,7 +504,7 @@ function updateReportActionMessage(reportID, sequenceNumber, message) {
// If this is the most recent message, update the lastMessageText in the report object as well
if (sequenceNumber === reportMaxSequenceNumbers[reportID]) {
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {
lastMessageText: message.html,
lastMessageText: message.html || `[${translateLocal('common.deletedCommentMessage')}]`,
});
}
}
Expand Down