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

LHN - [Comment Deleted] text translated in Spanish after refresh the page #7764

Closed
kbecciv opened this issue Feb 15, 2022 · 14 comments
Closed
Assignees
Labels
Engineering External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors Weekly KSv2

Comments

@kbecciv
Copy link

kbecciv commented Feb 15, 2022

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Launch App as login user
  2. Change English to Spanish
  3. Go back to LHN and verify that [Comment Deleted] alternate text should be translated.

Expected Result:

[Comment Deleted] alternate text should be translated in LHN

Actual Result:

[Comment Deleted] text translated in Spanish after refresh the page

Workaround:

Unknown

Platform:

Where is this issue occurring?

  • Web
  • iOS - [Comment Deleted] text translated in Spanish after closed and reopen the app
  • Android - [Comment Deleted] text translated in Spanish after closed and reopen the app
  • Desktop App
  • Mobile Web

Version Number: 1.1.39-1

Reproducible in staging?: Yes

Reproducible in production?: Yes

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos: Any additional supporting documentation

Bug5455148_1502.mp4
Recording.218.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause

Slack conversation:

Issue was found when executing: #7552

View all open jobs on GitHub

@MelvinBot
Copy link

Triggered auto assignment to @Julesssss (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@kbecciv kbecciv changed the title LHN - [Delete Attachment] text translated in Spanish after refresh the page LHN - [Comment Deleted] text translated in Spanish after refresh the page Feb 15, 2022
@parasharrajat
Copy link
Member

cc: @sobitneupane

@Julesssss Julesssss added the External Added to denote the issue can be worked on by a contributor label Feb 16, 2022
@MelvinBot
Copy link

Triggered auto assignment to @SofiedeVreese (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@sobitneupane
Copy link
Contributor

sobitneupane commented Feb 16, 2022

Proposal:
Return isLastMessageDeleted from getSimplifiedReportObject() in src/libs/actions/Report.js

let lastMessageText = null;
if (report.reportActionCount > 0) {
// We are removing any html tags from the message html since we cannot access the text version of any comments as
// the report only has the raw reportActionList and not the processed version returned by Report_GetHistory
// We convert the line-breaks in html to space ' ' before striping the tags
lastMessageText = lastActionMessage
.replace(/((<br[^>]*>)+)/gi, ' ')
.replace(/(<([^>]+)>)/gi, '') || `[${Localize.translateLocal('common.deletedCommentMessage')}]`;
lastMessageText = ReportUtils.formatReportLastMessageText(lastMessageText);
}

+    let isLastMessageDeleted = false;
    let lastMessageText = null;
    if (report.reportActionCount > 0) {
        // We are removing any html tags from the message html since we cannot access the text version of any comments as
        // the report only has the raw reportActionList and not the processed version returned by Report_GetHistory
        // We convert the line-breaks in html to space ' ' before striping the tags
        lastMessageText = lastActionMessage
            .replace(/((<br[^>]*>)+)/gi, ' ')
            .replace(/(<([^>]+)>)/gi, '') || `[${Localize.translateLocal('common.deletedCommentMessage')}]`;
        lastMessageText = ReportUtils.formatReportLastMessageText(lastMessageText);
+        isLastMessageDeleted = !lastActionMessage && true
    }

and use it in src/libs/OptionsListUtils.js in the following way:

const lastMessageTextFromReport = ReportUtils.isReportMessageAttachment(lodashGet(report, 'lastMessageText', ''))
? `[${Localize.translateLocal('common.attachment')}]`
: Str.htmlDecode(lodashGet(report, 'lastMessageText', ''));

 let lastMessageTextFromReport = ReportUtils.isReportMessageAttachment(lodashGet(report, 'lastMessageText', ''))
        ? `[${Localize.translateLocal('common.attachment')}]`
        : Str.htmlDecode(lodashGet(report, 'lastMessageText', ''));
+    lastMessageTextFromReport = lodashGet(report, 'isLastMessageDeleted', false) 
+        ? `[${Localize.translateLocal('common.deletedCommentMessage')}]`
+        : lastMessageTextFromReport;  

@thesahindia
Copy link
Member

Aren't we removing [comment deleted] in #7646 ?
cc: @parasharrajat @Julesssss

@Julesssss
Copy link
Contributor

Julesssss commented Feb 16, 2022

Yes, good spot.

It's not certain that we'll prioritize that improvement internally though. I think we should just make this fix anyway for now.

@parasharrajat
Copy link
Member

Oh. Sorry, I thought it is a regression so I tagged Sobit.

@SofiedeVreese
Copy link
Contributor

To reconfirm, this is not a regression and should be pushed externally?

@Julesssss
Copy link
Contributor

this is not a regression and should be pushed externally?
It could be, but I haven't been able to confirm.

Regardless it can be made external

@SofiedeVreese
Copy link
Contributor

Pushed to Upwork: https://www.upwork.com/jobs/~014083d785aaa36749

@MelvinBot
Copy link

Triggered auto assignment to Contributor-plus team member for initial proposal review - @rushatgabhane (Exported)

@MelvinBot MelvinBot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 18, 2022
@MelvinBot
Copy link

Current assignee @Julesssss is eligible for the Exported assigner, not assigning anyone new.

@rushatgabhane
Copy link
Member

@Julesssss there's already a PR out which makes this issue redundant, and it's like 99% done.

I suggest that we wait for #7711 to merge.

@Julesssss
Copy link
Contributor

I did see that but it didn't seem too close to completion previously. But yeah, as this still hasn't been assigned lets close it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Engineering External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors Weekly KSv2
Projects
None yet
Development

No branches or pull requests

9 participants