Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.5k stars 2.85k forks source link

[HOLD for #49355][$250] Room - HTML text is shown in Room Description #51048

Open lanitochka17 opened 1 week ago

lanitochka17 commented 1 week ago

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.0.50-0 Reproducible in staging?: Y Reproducible in production?: Y If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: No If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Email or phone of affected tester (no customers): applausetester+en@applause.expensifail.com Issue reported by: Applause - Internal Team

Action Performed:

  1. Open the iOS Hybrid app and access ND
  2. Sign into a valid account
  3. Go to Start Chat > Create a room
  4. After creation, add any description (For example: @test)
  5. Go back to the room Chat and send a message and observe the description text

Expected Result:

User expects the description to be unaffected

Actual Result:

HTML text is displayed after sending a message (OR leaving and joining the room via message)

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/user-attachments/assets/02ff0704-533d-4b82-9eca-0485cdb5ac40

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021847054312559267621
  • Upwork Job ID: 1847054312559267621
  • Last Price Increase: 2024-10-24
Issue OwnerCurrent Issue Owner: @ZhenjaHorbach
melvin-bot[bot] commented 1 week ago

Triggered auto assignment to @kadiealexander (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

lanitochka17 commented 1 week ago

@kadiealexander FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

Shahidullah-Muffakir commented 1 week ago

Proposal

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

The room description is currently displayed as an object, rather than plain text.

What is the root cause of that problem?

This issue occurs because the room description is being handled as a JSON object, but we are not properly parsing it or accessing the html property inside the objec

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

To resolve the issue, we need to parse the JSON object and extract the html property before processing the description

as: https://github.com/Expensify/App/blob/2c00cc58e713f0b8bb253d95e48b40503e7c1ddc/src/libs/ReportUtils.ts#L4242

as: return report?.description ? Parser.htmlToText(JSON.parse(report.description)?.html || '') : ''; and also in the welcome text section In the : https://github.com/Expensify/App/blob/2c00cc58e713f0b8bb253d95e48b40503e7c1ddc/src/libs/SidebarUtils.ts#L571

huult commented 1 week ago

Proposal

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

HTML text is shown in Room Description

What is the root cause of that problem?

This problem is caused by a change in the backend data type, specifically at the AddComment API. Other APIs are not affected. Previously, the response for report?.description was {description: "welcome text"}, but after the update, it responds with {description: "{\"html\":\"welcome text\"}"}. As a result, this issue occurs.

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

To fix this issue, we have two options. The first option is to update the backend so that the AddComment API returns the description in the old format. The second option is to update the report description after calling the AddComment API and use the description from Onyx. The code changes would be as follows:

//.src/libs/actions/Report.ts#L548
 const successData: OnyxUpdate[] = [
        {
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
            value: successReportActions,
        },
+        {
+            onyxMethod: Onyx.METHOD.MERGE,
+            key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
+            value: {
+                description: report?.description,
+            },
+       },
+    ];
https://github.com/user-attachments/assets/1161ed1b-4a6f-45a9-b660-ff3456ed07a8
melvin-bot[bot] commented 1 week ago

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

melvin-bot[bot] commented 1 week ago

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

truph01 commented 1 week ago

Dupe https://github.com/Expensify/App/issues/49355

melvin-bot[bot] commented 6 days ago

@kadiealexander, @ZhenjaHorbach Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

ZhenjaHorbach commented 5 days ago

Dupe #49355

Hmmmm Yeah Looks like these issues are similar

@kadiealexander Let's add HOLD and retest when this PR will be merged

melvin-bot[bot] commented 3 days ago

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸