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 for payment 2023-08-10] [$1000] Web - Select and copy does not copy New Expensify link in link format #23251

Closed
1 of 6 tasks
kbecciv opened this issue Jul 20, 2023 · 49 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@kbecciv
Copy link

kbecciv commented Jul 20, 2023

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


Action Performed:

  1. Open the app
  2. Open any report
  3. Send normal link eg: [test](google.com)
  4. Select the text and copy
  5. Paste and see it has proper link format
  6. Send newdot link eg: [test](staging.new.expensify.com/r/64705864) (note, the home link new.expensify.com does not reproduce this issue)
  7. Select the text and copy, paste and observe that now text is only displayed without link

Expected Result:

App should copy all links equally on select and copy

Actual Result:

App does not copy expensify links as links and display their text normally

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.42-18
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

copy.does.not.copy.expensify.link.mp4

Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1689704143206879

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~011c078f18bc8d09c6
  • Upwork Job ID: 1683719949577637888
  • 2023-07-25
  • Automatic offers:
    • dhanashree-sawant | Reporter | 25815614
@kbecciv kbecciv added Daily KSv2 Needs Reproduction Reproducible steps needed Bug Something is broken. Auto assigns a BugZero manager. labels Jul 20, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 20, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 20, 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

@samh-nl
Copy link
Contributor

samh-nl commented Jul 20, 2023

Proposal

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

Copying an expensify link does not translate to markdown when pasted into the composer.

What is the root cause of that problem?

Expensify links are handled via onPress rather than href. As no href prop is supplied, it causes the link to not be recognized as a valid link for conversion to markdown when pasting.

// Only pass the press handler for internal links. For public links or whitelisted internal links fallback to default link handling
onPress={internalNewExpensifyPath || internalExpensifyPath ? navigateToLink : undefined}

if (_.isFunction(props.onPress)) {
linkProps.onPress = props.onPress;
} else {
linkProps.href = props.href;
}

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

We should provide href also for Expensify links, however we should maintain navigation via onPress by stopping the event default behavior inside the handler function.

What alternative solutions did you explore? (Optional)

N/A

@kadiealexander
Copy link
Contributor

I'm not able to reproduce this:

2023-07-21_17-06-51.mp4

@dhanashree-sawant could you please take a look and see if we need to update the reproduction steps?

@dhanashree-sawant
Copy link

Hi @kadiealexander, can you try once with newdot expensify link? I am able to reproduce with that. On staging, with staging link and on live, with live link

@melvin-bot melvin-bot bot added the Overdue label Jul 24, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 24, 2023

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

@kadiealexander
Copy link
Contributor

@dhanashree-sawant I tried both and was still unable to reproduce:

Tested with new.expensify.com link from new.expensify.com on Chrome:

2023-07-25_16-10-30.mp4

Tested with staging.new.expensify.com link from staging.new.expensify.com on Chrome:

2023-07-25_16-12-27.mp4

@melvin-bot melvin-bot bot removed the Overdue label Jul 25, 2023
@dhanashree-sawant
Copy link

Thanks yes, sorry now I got it, I have tested with plain main page links and that seems to be working fine, if I write anything after the first '/', it causes the issue

eg: Try to copy any other report URL and send it as link with different alias test and that will trigger the error.

Sorry for the inconvenience till now.

2023-07-25.11-06-31.mp4

@kadiealexander
Copy link
Contributor

kadiealexander commented Jul 25, 2023

All good, glad we got to the root of it! :)

2023-07-25_18-02-45.mp4

@kadiealexander
Copy link
Contributor

Updated the reproduction steps with our findings.

@kadiealexander kadiealexander added External Added to denote the issue can be worked on by a contributor and removed Needs Reproduction Reproducible steps needed labels Jul 25, 2023
@melvin-bot melvin-bot bot changed the title Web - Select and copy does not copy expensify link in link format [$1000] Web - Select and copy does not copy expensify link in link format Jul 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

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

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

melvin-bot bot commented Jul 25, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

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

@kadiealexander kadiealexander changed the title [$1000] Web - Select and copy does not copy expensify link in link format [$1000] Web - Select and copy does not copy New Expensify link in link format Jul 25, 2023
@Parshvi16
Copy link
Contributor

Parshvi16 commented Jul 25, 2023

Proposal

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

new dot expensify URL can't be copied as URL if it is having some nesting in route

What is the root cause of that problem?

in BaseAnchorForCommentsOnly.js file

in our case, we are not getting href in linkProps, we are getting only onPress in linkProps.

when no href is present, Text component from react-native is not treating this as a Link, it is treating the data as text only, therefore we are not able to copy the link.

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

hrefAttrs={{
rel: props.rel,
target: isEmail ? '_self' : props.target,
}}
href={linkProps.href}
// Add testID so it gets selected as an anchor tag by SelectionScraper
testID="a"
// eslint-disable-next-line react/jsx-props-no-spreading

here no href is being passed because linkProps.href is null/undefined in our case.

so we can pass href={linkProps.href || props.href} in line no. 82.
This solves the issue and we are able to copy it as a link.

but, it leads to a problem, this internal link starts opening in new window.

to fix this, we modify line no. 80 as:

    target: isEmail || !linkProps.href ? '_self' : props.target,

if following event.preventDefault, to avoid refreshing the page, we need the following code:

onPress={(event) => {
                        if (!linkProps.onPress) {
                          return;
                        }
                      
                        event.preventDefault();
                        linkProps.onPress();
                      }}

What alternative solutions did you explore? (Optional)

N/A

@melvin-bot

This comment was marked as resolved.

@Parshvi16

This comment was marked as resolved.

@melvin-bot

This comment was marked as resolved.

@mananjadhav
Copy link
Collaborator

mananjadhav commented Jul 26, 2023

Both the proposals have the correct RCA, but @Parshvi16's proposal is more complete as it mentions how to deal with links opened in new window.

🎀 👀 🎀 C+ reviewed.

@mananjadhav
Copy link
Collaborator

Apologies for the delay in the response here. I see some of the comments edited, hence wanted to verify before I respond.

@samh-nl to address your comments, your proposal originally lacked any technical details. I don't expect the code, but at-least where/how do we pass the hrefs, etc. should've been a part of the proposal. And we do work out changes in the PR, bugs that come across testing when the PR is raised.

About you mentioning the proposal being completely incorrect, if we come across this in the PR/issue, we would open up again for the proposals, where the new/existing proposals would be reviewed for the expected behavior. This generally doesn't happen, but I won't say it has never happened.

Lastly, @Parshvi16 I would recommend sticking to the original proposals while implementing the solution, so that we're fair in any process without any conflicts.

@samh-nl
Copy link
Contributor

samh-nl commented Jul 31, 2023

@mananjadhav Ok appreciate the feedback, I will take that into account going forward.

@melvin-bot
Copy link

melvin-bot bot commented Aug 1, 2023

🎯 ⚡️ Woah @mananjadhav / @Parshvi16, great job pushing this forwards! ⚡️

The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉

  • when @Parshvi16 got assigned: 2023-07-28 19:23:58 Z
  • when the PR got merged: 2023-08-01 19:00:50 UTC

On to the next one 🚀

@Parshvi16
Copy link
Contributor

@roryabraham I'm not yet hired on upwork for this issue. Please check.

@mananjadhav
Copy link
Collaborator

@roryabraham I'm not yet hired on upwork for this issue. Please check.

@kadiealexander Can you please help here?

@kadiealexander
Copy link
Contributor

@Parshvi16 please apply to the Upwork job, as I can't find your application. Thanks!

@Parshvi16
Copy link
Contributor

Sorry, I just checked, my account is on hold due to surname spelling issue. can I use my friend's Upwork account? or should I wait?
I'm waiting to be paid for 2 issue:
https://www.upwork.com/jobs/~011c078f18bc8d09c6
https://www.upwork.com/jobs/~01a5685c1928bbd220 (hired but not payed yet)
@kadiealexander please guide here

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Aug 3, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Web - Select and copy does not copy New Expensify link in link format [HOLD for payment 2023-08-10] [$1000] Web - Select and copy does not copy New Expensify link in link format Aug 3, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 3, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 3, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot
Copy link

melvin-bot bot commented Aug 3, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.49-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-08-10. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

For reference, here are some details about the assignees on this issue:

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Aug 3, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@mananjadhav] The PR that introduced the bug has been identified. Link to the PR:
  • [@mananjadhav] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@mananjadhav] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@mananjadhav] Determine if we should create a regression test for this bug.
  • [@mananjadhav] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@kadiealexander] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@Parshvi16
Copy link
Contributor

@kadiealexander please check #23251 (comment)
I'd like to update my upwork account link.
also, for https://www.upwork.com/jobs/~01a5685c1928bbd220, please end the contract and re-hire me through this new upwork account. should i provide new account link here?
also, please update it in automation(melvin).

@kadiealexander
Copy link
Contributor

@Parshvi16 Please post on the associated Github issues for those jobs and the relevant team member will assist you.

For this job, I need you to apply here: https://www.upwork.com/jobs/~011c078f18bc8d09c6

@Parshvi16
Copy link
Contributor

@kadiealexander submitted the proposal, please accept.

@kadiealexander
Copy link
Contributor

Could you please let me know the name of the person you used to apply?

@Parshvi16
Copy link
Contributor

@kadiealexander
Copy link
Contributor

Offer sent :)

@kadiealexander
Copy link
Contributor

kadiealexander commented Aug 4, 2023

Payouts due on August 10th:

Eligible for 50% #urgency bonus? Yes

Upwork job is here.

@mananjadhav
Copy link
Collaborator

mananjadhav commented Aug 8, 2023

I can't pinpoint to a specific PR, as we've got the links working since a long time. Hence, there is no offending PR.

I also don't think we need a regression test for this one.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Aug 9, 2023
@mananjadhav
Copy link
Collaborator

@kadiealexander I've raised my request on NewDot.

@JmillsExpensify
Copy link

Reviewed the details for @mananjadhav. This is approved for payment in NewDot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

8 participants