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

[$250] Room - # room from room description is highlighted when edit description #42678

Closed
1 of 6 tasks
lanitochka17 opened this issue May 27, 2024 · 19 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

@lanitochka17
Copy link

lanitochka17 commented May 27, 2024

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: 1.4.76-0
Reproducible in staging?: Y
Reproducible in production?: Y
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): gocemate+a93@gmail.com
Issue reported by: Applause - Internal Team

Action Performed:

  1. Start creating a room
  2. On room description add text this room is to send cute cat memes > Create room
  3. Verify you navigate to room page
  4. Click on description and edit the text ("This #room is to send cute cat memes edited")> Save
  5. Take a note of description section on room conversation page

Expected Result:

There should be no highlighted words when edit description

Actual Result:

#room word from room description becomes highlighted when edit description

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6493332_1716842384426.Recording__3053.mp4
image

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01d22835d6951d7024
  • Upwork Job ID: 1795289072448532480
  • Last Price Increase: 2024-05-28
Issue OwnerCurrent Issue Owner: @Christinadobrzyn
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 27, 2024
Copy link

melvin-bot bot commented May 27, 2024

Triggered auto assignment to @Christinadobrzyn (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.

@allgandalf
Copy link
Contributor

Proposal

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

We parse # as <mention-report> when we update room description.

What is the root cause of that problem?

In #40685, we added reportID as a extra prop:

const parsedDescription = ReportUtils.getParsedComment(newValue, {reportID});

ReportUtils.getParsedComment(newValue, {reportID}); , here we started passing reportID, but this lead to an unexpected bug which converted # into mention-report:
Screenshot 2024-05-28 at 5 17 45 AM

The PR #40685 was intended to deal with comments in report, where we stopped sending <mention-report> when not in a policy room, but in the PR a small block of code related to room description was also updated, and hence we are having this bug, if we revert #40685, this doesn't happen anymore.

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

As we used to parse before #40685, we can update the function to:

const parsedDescription = ReportUtils.getParsedComment(newValue);

What alternative solutions did you explore? (Optional)

@Christinadobrzyn Christinadobrzyn added the External Added to denote the issue can be worked on by a contributor label May 28, 2024
Copy link

melvin-bot bot commented May 28, 2024

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

@melvin-bot melvin-bot bot changed the title Room - # room from room description is highlighted when edit description [$250] Room - # room from room description is highlighted when edit description May 28, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label May 28, 2024
Copy link

melvin-bot bot commented May 28, 2024

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

@Christinadobrzyn
Copy link
Contributor

I wonder if a better solution for product consistency is to throw the same error as shows when creating a new room

image

Error message is: Room names can only include lowercase letters, numbers and hyphens.

@allgandalf
Copy link
Contributor

We allow Markdown for description, so I think the current expected behavior is correct @Christinadobrzyn

@nkdengineer
Copy link
Contributor

nkdengineer commented May 28, 2024

Proposal

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

I believe the OP expected result is not correct. It's expected that the room will be highlighted because it's a policy room, and in policy rooms we support report mentions.

The real problem here is that when creating a room with #room in description, it does not highlight, but when editing, it does.

What is the root cause of that problem?

When adding a room here, we forgot to parse the room description, like we did when updating the description

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

We need to parse the description when adding a report too.

  • Modify getParsedComment to accept a 3rd param report, if it exists, use it here in place of getReport. Because when the report is optimistic, it's not there for the getReport to get yet, so we need to pass it in directly.

  • In

    , add

const parsedDescription = ReportUtils.getParsedComment(policyReport.description ?? '', {reportID: policyReport.reportID}, policyReport);
  • Use the parsedDescription as the description in optimisticData.

What alternative solutions did you explore? (Optional)

We can further check similar places and fix if getParsedComment is forgotten to be added

@dragnoir
Copy link
Contributor

dragnoir commented May 28, 2024

Proposal

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

Room - # room from room description is highlighted when edit description

What is the root cause of that problem?

On RoomDescriptionPage when we submitForm, we call for the function Report.updateDescription

const submitForm = useCallback(() => {
Report.updateDescription(report.reportID, report?.description ?? '', description.trim());
}, [report.reportID, report.description, description]);

Now the #room inside the description value is sent to updateDescription as #room

inside Report.updateDescription we use getParsedComment to transform #room to <mention-report>#room</mention-report> before it's saved to Onyx and BE

https://github.com/Expensify/App/blob/2514f2988eb26858d30fa501c0040b1f8fc2e239/src/libs/actions/Report.ts#L1912C43-L1912C59

The issue is within getParsedComment, because we are attaching the reportID here, the function is transforming the #room to <mention-report>#room</mention-report>

App/src/libs/ReportUtils.ts

Lines 3395 to 3398 in 2514f29

if (parsingDetails?.reportID) {
const currentReport = getReport(parsingDetails?.reportID);
isGroupPolicyReport = isReportInGroupPolicy(currentReport);
}

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

We need to add a new props to updateDescription like ignoreMention and use it on room description,

const submitForm = useCallback(() => {
Report.updateDescription(report.reportID, report?.description ?? '', description.trim());
}, [report.reportID, report.description, description]);

this prop will pass this part

App/src/libs/ReportUtils.ts

Lines 3395 to 3398 in 2514f29

if (parsingDetails?.reportID) {
const currentReport = getReport(parsingDetails?.reportID);
isGroupPolicyReport = isReportInGroupPolicy(currentReport);
}

or it will make suree wi don't use the shoudlDisableRules ? ['reportMentions']

What alternative solutions did you explore?

@getusha
Copy link
Contributor

getusha commented May 28, 2024

@GandalfGwaihir isn't the purpose of this PR, to prevent #room from being parsed?

@nkdengineer
Copy link
Contributor

@getusha The purpose of the PR is to prevent report mention (eg #room) from being parsed for non-policy reports (eg. DM, ...). For policy reports report mention should still work/be parsed.

@allgandalf
Copy link
Contributor

allgandalf commented May 28, 2024

@GandalfGwaihir isn't the purpose of this #40685, to prevent #room from being parsed?

@getusha When you check the videos of that PR, this was intended to be specific to comments we post in chat I assume(chats in policy).

@nkdengineer
Copy link
Contributor

this was intended to be specific to comments we post in chat I assume(chats in policy).

Not only comments but anything in the report too, including description. Normally for description and comment of the same report we always support the same set of markdowns.

@Christinadobrzyn
Copy link
Contributor

I'm just double-checking the expected behaviour for this - https://expensify.slack.com/archives/C066HJM2CAZ/p1717035618513299

@melvin-bot melvin-bot bot added the Overdue label May 31, 2024
@Christinadobrzyn
Copy link
Contributor

Based on the team discussion - I think we only need to fix the actionable whisper - confirming before we continue - https://expensify.slack.com/archives/C066HJM2CAZ/p1717122819898099?thread_ts=1717035618.513299&cid=C066HJM2CAZ

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels May 31, 2024
@getusha
Copy link
Contributor

getusha commented Jun 3, 2024

The actionable whisper was a backend bug, which is fixed now, deployed yesterday I think.
Regarding the issue, I think there is nothing to be done there, we just need to start highlighting report mentions in the description when creating a room, but I believe we can do that in a different issue so things don't get confused.

@Christinadobrzyn i think we can close this? https://expensify.slack.com/archives/C066HJM2CAZ/p1717160228281969?thread_ts=1717035618.513299&cid=C066HJM2CAZ

Copy link

melvin-bot bot commented Jun 3, 2024

@Christinadobrzyn, @getusha Whoops! This issue is 2 days overdue. Let's get this updated quick!

@Christinadobrzyn
Copy link
Contributor

Yes @getusha - good call. We'll close. Thanks!

@nkdengineer
Copy link
Contributor

we just need to start highlighting report mentions in the description when creating a room, but I believe we can do that in a different issue so things don't get confused.

@Christinadobrzyn @getusha I identified this bug in my proposal. I think we can modify the OP to fix this issue here, because it's related to the original issue.

What do you think?

If not we can create another GH issue and link it here, then I can repost my proposal there.

@nkdengineer
Copy link
Contributor

@Christinadobrzyn Quick bump on #42678 (comment), thanks 🙇

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
No open projects
Archived in project
Development

No branches or pull requests

6 participants