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

[$500] Chat - Inconsistent in URL display while editing comment #28162

Closed
6 tasks
lanitochka17 opened this issue Sep 25, 2023 · 8 comments
Closed
6 tasks

[$500] Chat - Inconsistent in URL display while editing comment #28162

lanitochka17 opened this issue Sep 25, 2023 · 8 comments
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 Sep 25, 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. Launch app
  2. Tap on a report
  3. Enter an url and send
  4. Long press the sent message and tap edit comment
  5. Delete the entire message and enter the same url and send
  6. Note the url is not shown as link
  7. Again perform step3-step4
  8. Delete the entire message and enter different url and send

Expected Result:

If an url is sent and edited with same url, then it is not shown as link. But if we enter different url while editing, then it is shown as link. There should not be inconsistent behaviour when user send url while editing comment

Actual Result:

If an url is sent and edited with same url, then it is not shown as link. But if we enter different url while editing, then it is shown as link

Workaround:

Unknown

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.74-1

Reproducible in staging?: Yes

Reproducible in production?: Yes

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

Bug6213759_url.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~014bb50037929a38de
  • Upwork Job ID: 1706695143749767168
  • Last Price Increase: 2023-09-26
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 25, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 25, 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

@abdel-h66
Copy link
Contributor

Proposal

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

When editing a comment, any existing text that looks like a link will be transformed to a markdown link upon the save.

What is the root cause of that problem?

Any URL looking text is not considered when editing a comment because parser.replace(newCommentText) is called anytime a comment is editing, meaning that the previous text formatting will be lost and transformed to markdown.

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

We should find a better way to handle the URL intentional deletes from the comment done by this function

App/src/libs/actions/Report.js

Lines 1128 to 1137 in f5409e7

const handleUserDeletedLinksInHtml = (newCommentText, originalHtml) => {
const parser = new ExpensiMark();
if (newCommentText.length > CONST.MAX_MARKUP_LENGTH) {
return newCommentText;
}
const markdownOriginalComment = parser.htmlToMarkdown(originalHtml).trim();
const htmlForNewComment = parser.replace(newCommentText);
const removedLinks = parser.getRemovedMarkdownLinks(markdownOriginalComment, newCommentText);
return removeLinksFromHtml(htmlForNewComment, removedLinks);
};

And at the same time, preserve any markdown that were only in the original comment. By finding which links that were actually added upon the current and the existing ones.

So before transforming the edited text to a markdown, we can run this function that will return an array of the added links vs what's been already there.

const getAddedMarkdownLinks = (parser, newComment, oldComment) => {

    const linksInOld = parser.extractLinksInMarkdownComment(oldComment);
    const linksInNew = parser.extractLinksInMarkdownComment(newComment);


    return linksInOld === undefined || linksInNew === undefined ? [] : _.difference(linksInNew, linksInOld);
}

And the apply handleUserDeletedLinksInHtml.

What alternative solutions did you explore? (Optional)

N/A

@isabelastisser isabelastisser added the External Added to denote the issue can be worked on by a contributor label Sep 26, 2023
@melvin-bot melvin-bot bot changed the title Chat - Inconsistent in URL display while editing comment [$500] Chat - Inconsistent in URL display while editing comment Sep 26, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 26, 2023

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

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

melvin-bot bot commented Sep 26, 2023

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

@agilejune
Copy link

it's intentional behaviour , dupe of #24258

@melvin-bot
Copy link

melvin-bot bot commented Sep 26, 2023

📣 @agilejune! 📣
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. Make sure you've read and understood the contributing guidelines.
  2. 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.
  3. 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.
  4. 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>

@allroundexperts
Copy link
Contributor

Yep. This is expected. Let's close this @isabelastisser!

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

5 participants