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

[HOLD #19218] [$1000] The new description on the report displays &lt for < #19386

Closed
1 of 6 tasks
kavimuru opened this issue May 22, 2023 · 21 comments
Closed
1 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 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

Comments

@kavimuru
Copy link

kavimuru commented May 22, 2023

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. Go to staging dot on chrome
  2. Click on + icon, Select request money. Add a description with <. Request money
  3. Now click on the money report. Again click on the report.
  4. Result : See that in the new description before date field shows < as &lt.
  5. Now refresh the page to make it visible

Expected Result:

The new description on the report should not display &lt for < as how it is done in the money report

Actual Result:

The new description on the report displays &lt for < (works well with money report)

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.16-6
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

error-2023-05-19_11.04.53.mp4
Recording.715.mp4

Expensify/Expensify Issue URL:
Issue reported by: @avi-shek-jha
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1684473836089219

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~018a6bdbdd645dde11
  • Upwork Job ID: 1660699049866764288
  • Last Price Increase: 2023-05-22
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 22, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 22, 2023

Triggered auto assignment to @puneetlath (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented May 22, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@PrashantMangukiya
Copy link
Contributor

PrashantMangukiya commented May 22, 2023

Proposal

Posting proposal early as per new guidelines

Please re-state the problem that we are trying to solve in this issue.

The new description on the report displays &lt for <

What is the root cause of that problem?

Description render via this code

<MenuItemWithTopDescription
description={props.translate('common.description')}
title={transactionDescription}
/>

At line 186 we are not using htmlDecode while display transaction description. This is the root cause of the problem.

What changes do you think we should make in order to solve the problem?

We have to use Str.htmlDecode() while display the transaction description as shown below:

        <MenuItemWithTopDescription
            description={props.translate('common.description')}
            //title={transactionDescription}   // ** OLD 
            title={Str.htmlDecode(transactionDescription)}   // **** Updated Code
        />

This will solve the issue as shown in result.

What alternative solutions did you explore? (Optional)

None

Result IOUDesc

@hoangzinh
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

The new description on the report displays &lt for <

What is the root cause of that problem?

Currently, the comment data in originalMessage is stored with html encoded format.
Screenshot 2023-05-22 at 22 35 39

When we show this comment data in MoneyRequestHeader, we haven't decoded it yet

title={transactionDescription}

So it shows raw data with html encoded format.

What changes do you think we should make in order to solve the problem?

In IOUPreview, we also use same util ReportUtils.getMoneyRequestAction and have to decode out side. So I think instead of replicate logic, we can fix it inside util ReportUtils.getMoneyRequestAction so that it decodes the comment from originalMessage + trim white spaces too in this line

let comment = originalMessage.comment || '';

@puneetlath puneetlath added the External Added to denote the issue can be worked on by a contributor label May 22, 2023
@melvin-bot melvin-bot bot changed the title The new description on the report displays &lt for < [$1000] The new description on the report displays &lt for < May 22, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 22, 2023

Job added to Upwork: https://www.upwork.com/jobs/~018a6bdbdd645dde11

@melvin-bot
Copy link

melvin-bot bot commented May 22, 2023

Current assignee @puneetlath is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented May 22, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label May 22, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 22, 2023

Current assignee @puneetlath is eligible for the External assigner, not assigning anyone new.

@spcheema
Copy link
Contributor

spcheema commented May 23, 2023

Proposal

Posting proposal early as per new guidelines

Please re-state the problem that we are trying to solve in this issue.

The new description on the report displays &lt for <

What is the root cause of that problem?

Description rendered in the file App/src/components/MoneyRequestHeader.js at line description={props.translate('common.description')}

                <>
                    <MenuItemWithTopDescription
                        title={formattedTransactionAmount}
                        description={`${props.translate('iou.amount')}${props.translate('iou.cash')}`}
                        titleStyle={styles.newKansasLarge}
                    />
                    <MenuItemWithTopDescription
                        description={props.translate('common.description')}
                        title={transactionDescription}
                    />
                    <MenuItemWithTopDescription
                        description={props.translate('common.date')}
                        title={formattedTransactionDate}
                    />
                </>

What changes do you think we should make in order to solve the problem?

transactionDescription should be using Str.htmlDecode as bellow:

            <MenuItemWithTopDescription
                        description={props.translate('common.description')}
                        title={Str.htmlDecode(transactionDescription)} 
                    />

What alternative solutions did you explore? (Optional)

There is another common that can updated to resolve the issue:

In the file src/components/ReportActionItem/IOUPreview.js remove html entity decoding at line 154

     // const requestComment = Str.htmlDecode(moneyRequestAction.comment).trim();  /** Old code **/
     const requestComment = moneyRequestAction.comment;     /** updated code **/

Implemented html entities decoding in getMoneyRequestAction function located in the file src/libs/ReportUtils.js

Here is updated code:

**
 * We get the amount, currency and comment money request value from the action.originalMessage.
 * But for the send money action, the above value is put in the IOUDetails object.
 *
 * @param {Object} reportAction
 * @param {Number} reportAction.amount
 * @param {String} reportAction.currency
 * @param {String} reportAction.comment
 * @param {Object} [reportAction.IOUDetails]
 * @returns {Object}
 */
function getMoneyRequestAction(reportAction = {}) {
    const originalMessage = lodashGet(reportAction, 'originalMessage', {});
    let amount = originalMessage.amount || 0;
    let currency = originalMessage.currency || CONST.CURRENCY.USD;
    let comment = Str.htmlDecode(originalMessage.comment.trim()) || '';   // Added html decode here 

    if (_.has(originalMessage, 'IOUDetails')) {
        amount = lodashGet(originalMessage, 'IOUDetails.amount', 0);
        currency = lodashGet(originalMessage, 'IOUDetails.currency', CONST.CURRENCY.USD);
        comment = lodashGet(originalMessage, 'IOUDetails.comment', '');
    }

    return {amount, currency, comment};
}

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: upwork profile

@melvin-bot
Copy link

melvin-bot bot commented May 23, 2023

📣 @spcheema! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@fedirjh
Copy link
Contributor

fedirjh commented May 24, 2023

Reviewing today

@fedirjh
Copy link
Contributor

fedirjh commented May 25, 2023

Thanks to everyone for the proposals. The RCA (Root Cause Analysis) clearly indicates that we are not decoding the HTML-encoded string. I think the appropriate approach we should follow is to fix the getMoneyRequestAction function. By doing so, we will ensure that we address the root cause and any other potential hidden cases.

Based on what has been said, I believe we should proceed with this proposal by @hoangzinh

cc @puneetlath

🎀 👀 🎀 C+ reviewed

@fedirjh
Copy link
Contributor

fedirjh commented May 25, 2023

@spcheema Thanks for the proposal , but it is a duplicate from @hoangzinh proposal

@spcheema
Copy link
Contributor

Thanks for review @fedirjh

@Victor-Nyagudi
Copy link
Contributor

@fedirjh I think this other issue where using backticks in the send/request money description changes them to &#x60; might be related if not the same.

A pull request is also currently being worked on/reviewed that might fix this issue.

What are your thoughts on this?

cc: @puneetlath

@fedirjh
Copy link
Contributor

fedirjh commented May 25, 2023

Thanks @Victor-Nyagudi for great catch . Cc @mollfpr could you please verify if this case will be fixed by this pr #19218 ?

@mollfpr
Copy link
Contributor

mollfpr commented May 25, 2023

@fedirjh Ahh, yes! We will send the text as is without parsing it to markdown.

@fedirjh
Copy link
Contributor

fedirjh commented May 25, 2023

@puneetlath Let's hold it for #19218

@puneetlath puneetlath changed the title [$1000] The new description on the report displays &lt for < [HOLD #19331] [$1000] The new description on the report displays &lt for < May 25, 2023
@melvin-bot melvin-bot bot added the Overdue label May 29, 2023
@puneetlath puneetlath changed the title [HOLD #19331] [$1000] The new description on the report displays &lt for < [HOLD #19218] [$1000] The new description on the report displays &lt for < May 29, 2023
@puneetlath
Copy link
Contributor

Still on hold.

@melvin-bot melvin-bot bot removed the Overdue label May 29, 2023
@melvin-bot melvin-bot bot added the Overdue label Jun 1, 2023
@fedirjh
Copy link
Contributor

fedirjh commented Jun 1, 2023

@puneetlath It looks to be fixed, PR was deployed to prod , I think we can close this issue

Screenshot 2023-06-01 at 9 04 25 PM

@melvin-bot melvin-bot bot removed the Overdue label Jun 1, 2023
@puneetlath
Copy link
Contributor

Makes sense. Thanks everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 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
Projects
None yet
Development

No branches or pull requests

8 participants