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] Compose -Copy URL to clipboard shows url link and markdown text. #31422

Closed
5 of 6 tasks
izarutskaya opened this issue Nov 16, 2023 · 64 comments
Closed
5 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 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

Comments

@izarutskaya
Copy link

izarutskaya commented Nov 16, 2023

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


Version Number: 1.4.0-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:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause-Internal Team
Slack conversation: @

Action Performed:

  1. Go to https://staging.new.expensify.com
  2. Open any report
  3. Paste *text https://expensify.com#abc*
  4. Send the message
  5. Observe that * bolding doesn't work.

Expected Result:

Link should be bolded

Actual Result:

Link is not bolded, markdown * are showing

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

Bug6278535_1700104850573.star.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01b6ad7e1bea3c914c
  • Upwork Job ID: 1725070533592285184
  • Last Price Increase: 2024-02-16
@izarutskaya izarutskaya added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 16, 2023
@melvin-bot melvin-bot bot changed the title Compose -Copy URL to clipboard shows url link and markdown text. [$500] Compose -Copy URL to clipboard shows url link and markdown text. Nov 16, 2023
Copy link

melvin-bot bot commented Nov 16, 2023

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

Copy link

melvin-bot bot commented Nov 16, 2023

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

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

melvin-bot bot commented Nov 16, 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

Copy link

melvin-bot bot commented Nov 16, 2023

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

@s-alves10
Copy link
Contributor

@izarutskaya

Will you let me know what the original text is?

@tienifr
Copy link
Contributor

tienifr commented Nov 16, 2023

Proposal

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

Paste URL with hash inside bold markdown does not apply the bold markdown

*text https://expensify.com#abc*

What is the root cause of that problem?

Our bold rule is currently after the auto link rule, so at the time bold rule is processed, the auto link already assumes the * as belonging to its hash, thus the auto link does not apply.

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

  1. Move the bold rule above the auto link rule
  2. Modify the auto link (and possibly auto email) rule so that it allows auto linking inside bold tags. (The sam approach is already done for the autoemail, see the ?!em part here

The current auto link regex is here

We need to update the <\\/) part to <\\/(?!strong|em>)) so that it allows auto link inside strong and em tag

Same for auto email here, update ?!em to ?!em|strong
3. Fix the block quote rule so it works with the new bold order

We can fix the same for other tags like italic (move above bold tag), strikethrough, ...

What alternative solutions did you explore? (Optional)

Modify the auto link rule to not consume the bold/italic character if it's entirely inside the special character pairs for bold, italic, ...
In here, we can add ([^_*~]*?) after ([_*~]*?) to match additional characters after the first * and modify modifyTextForUrlLinks to append the text properly.

@tienifr
Copy link
Contributor

tienifr commented Nov 16, 2023

Will you let me know what the original text is?

@s-alves10 please try with this text *text https://expensify.com#abc*

@melvin-bot melvin-bot bot added the Overdue label Nov 20, 2023
Copy link

melvin-bot bot commented Nov 21, 2023

@ntdiary, @peterdbarkerUK Eep! 4 days overdue now. Issues have feelings too...

@peterdbarkerUK
Copy link
Contributor

repro'd and updated OP

@melvin-bot melvin-bot bot removed the Overdue label Nov 21, 2023
@css1022
Copy link

css1022 commented Nov 22, 2023

Proposal

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

URL with hash inside bold markdown does not apply the bold markdown

*text https://expensify.com#abc*

What is the root cause of that problem?

The bold rule is after the auto link rule,
The auto link markdown parses url with ending * before bold rule is applied, thus the bold rule does not apply.

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

If Url with ending asterisk is part of string which is likely to be parsed as bold (e.g. *text https://expensify.com#abc*),
we should not contain ending * as part of url.
To do that, we can add following process in modifyTextForUrlLinks function.
The process is to exclude ending asterisk if there is string with asterisk leading to url .

                if (numberOfCharsToRemove) {
                    match[0] = match[0].substring(0, match[0].length - numberOfCharsToRemove);
                    url = url.substring(0, url.length - numberOfCharsToRemove);
                }
            }
--------->
            if (match.index !== 0) {
                const stringBeforeUrl = textToCheck.substring(startIndex, match.index);
                const lastChar = url.charAt(url.length - 1);
                if (lastChar === '*' && stringBeforeUrl.includes(lastChar)) {
                    match[0] = match[0].substring(0, match[0].length - 1);
                    url = url.substring(0, url.length - 1);
                }
            }
<-----------
            replacedText = replacedText.concat(textToCheck.substr(startIndex, (match.index - startIndex)));

we can add relevant test case

This approach does not make other test cases failed.

Copy link

melvin-bot bot commented Nov 22, 2023

📣 @css1022! 📣
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>

Copy link

melvin-bot bot commented Nov 23, 2023

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

@peterdbarkerUK
Copy link
Contributor

@css1022 Could you follow the instructions here? Thank you!

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Nov 24, 2023
@0xmiros
Copy link
Contributor

0xmiros commented Nov 28, 2023

This seems like dupe of #30823

Copy link

melvin-bot bot commented Nov 28, 2023

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

@peterdbarkerUK
Copy link
Contributor

I would agree it seems to be the same root cause of where * fits int he regex pattern. @r3770 could you clarify why you disagree?

@melvin-bot melvin-bot bot removed the Overdue label Nov 28, 2023
@melvin-bot melvin-bot bot added the Overdue label Feb 5, 2024
@ntdiary
Copy link
Contributor

ntdiary commented Feb 5, 2024

Alright, it actually looks like the PR for #30823 is merged (not deployed, because it seems like the repo doesn't have a deploy process).

So this is off hold now.

@ntdiary what's the next step now this is off hold? Re-test the reproduction steps?

@conorpendergrast, eh, that PR has been deployed to the production, but it didn't resolve this issue. BTW, here's the structure of the URL:
image

So far, we allow the * character in both the Parameters and Anchor parts, and I have just tested it again, and it seems the rule is consistent with Slack app. So, personally, I don't have strong feeling about fixing this issue (it's okay to just close this issue).

image

However, if we still want to fix this issue eventually, we can continue to wait for some new proposals, because the above proposals don't seem to be very perfect. :)

@melvin-bot melvin-bot bot removed the Overdue label Feb 5, 2024
@conorpendergrast
Copy link
Contributor

Fantastic, thanks for that @ntdiary - I'm coming to this late, so that's really helpful. I'll take another pass through, reproduce it too, and then will recommend fixing or closing.

@conorpendergrast
Copy link
Contributor

Ok, I've reproduced this again too.

So, personally, I don't have strong feeling about fixing this issue (it's okay to just close this issue).

Thinking with my customer support hat on, I think I can imagine myself sending a message like:

*Please go to https://help.expensify.com/articles/expensify-classic/bank-accounts-and-credit-cards/business-bank-accounts/Business-Bank-Accounts-AUD#bank-specific-batch-payment-support*

which doesn't work:
image

Whereas the workaround is:

*Please go to* *[https://help.expensify.com/articles/expensify-classic/bank-accounts-and-credit-cards/business-bank-accounts/Business-Bank-Accounts-AUD#bank-specific-batch-payment-support](https://help.expensify.com/articles/expensify-classic/bank-accounts-and-credit-cards/business-bank-accounts/Business-Bank-Accounts-AUD#bank-specific-batch-payment-support)*

Which does work:

image

@conorpendergrast
Copy link
Contributor

I've posted to #expensify-open-source in Slack to get discussion on closing this out

@melvin-bot melvin-bot bot added the Overdue label Feb 8, 2024
Copy link

melvin-bot bot commented Feb 9, 2024

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

Copy link

melvin-bot bot commented Feb 9, 2024

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

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Feb 12, 2024
@slafortune slafortune added Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels Feb 12, 2024
Copy link

melvin-bot bot commented Feb 12, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Feb 12, 2024
@sakluger
Copy link
Contributor

Hi @ntdiary, I'd like to fix this issue, and I think that Conor's proposed fix in his comment here is a good solution.

@melvin-bot melvin-bot bot added the Overdue label Feb 15, 2024
@ntdiary
Copy link
Contributor

ntdiary commented Feb 16, 2024

Hi @ntdiary, I'd like to fix this issue, and I think that Conor's proposed fix in his comment here is a good solution.

@sakluger, are you referring to this workaround?

*Please go to* *[https://help.expensify.com/articles/expensify-classic/bank-accounts-and-credit-cards/business-bank-accounts/Business-Bank-Accounts-AUD#bank-specific-batch-payment-support](https://help.expensify.com/articles/expensify-classic/bank-accounts-and-credit-cards/business-bank-accounts/Business-Bank-Accounts-AUD#bank-specific-batch-payment-support)*

Our app already supports this workaround, but our customers need to use the standard markdown link format, which is [title](link).

If we want to use both autolink and bold format (i.e., *go to google.com#abc*), we need to improve our autolink regexp pattern.

@melvin-bot melvin-bot bot removed the Overdue label Feb 16, 2024
Copy link

melvin-bot bot commented Feb 16, 2024

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

@melvin-bot melvin-bot bot added the Overdue label Feb 19, 2024
Copy link

melvin-bot bot commented Feb 19, 2024

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

@sakluger
Copy link
Contributor

Hi @ntdiary - I misunderstood Conor's comment before, sorry about that! I thought his "workaround" was a proposed solution when it's actually what the user would have to do to make the whole text line bold.

I did a bit more research and found that it's possible for URLs to have *'s. For that reason, I think we should leave the current edge-case bug as is.

In the future, after we add live markdown previews, we'll also add keyboard shortcuts (i.e. Command+b) at some point, which will make this less of an issue.

@melvin-bot melvin-bot bot removed the Overdue label Feb 19, 2024
@github-project-automation github-project-automation bot moved this from LOW to CRITICAL in [#whatsnext] #vip-vsb Feb 19, 2024
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 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
Projects
No open projects
Status: CRITICAL
Development

No branches or pull requests