App: [HOLD for payment 2022-08-30] [$250] Right clicking and “Copy Link” on a link produced https://new.expensify.com//r/0/NaN when pasted
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
This Issue has been divided in 2 parts, as it evolved while it was being discusses, the solution to both the situations is similar, and it would be easier to keep them in one GH.
1st Situation
Action Performed:
- Send any link (e.g. Google.com) to a chat on web.
- Right-click on the link to open the context menu.
- Check that you see 2 option,
Copy linkandCopy URL to clipboard
Expected Result:
We should only display the Copy URL to clipboard option
Actual Result:
We show both options and it’s confusing
2nd Situation
- Add an attachement to a chat on web.
- Right-click on the link to open the context menu.
- Check that you see several options including
Copy linkandCopy to clipboard
Expected Result:
We should only Download, Mark as unread, Delete comment
Actual Result:
We show all of the above option, and it’s confusing
Workaround:
unknown
Platform:
Where is this issue occurring?
- Web
- iOS
- Android
- Desktop App
- Mobile Web
Version Number: 1.1.79-9
Reproducible in staging?: Y
Reproducible in production?: Y
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

Expensify/Expensify Issue URL: Issue reported by: @marcaaron Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1656523285065139
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 51 (40 by maintainers)
I agree that
Copy linkvsCopy URL to clipboardis confusing. Reading up in the slack thread, I think @marcaaron made some really good arguments for why we should just displayCopy URL to clipboardif you right-click on the link, so 👍 there. I also think that the same logic should apply if you right-click an email link, which has this same bug.Yep!
shouldShowfunctionBaseReportActionContextMenucomponent has atypeprop that’s passed to theshouldShowfunction for each context action.Copy linkif you right-click on a link or email, then all we have to do is change this line toshouldShow: type => type === CONTEXT_MENU_TYPES.REPORT_ACTION,I updated the GH, @parasharrajat and @Harshdeepjoshi let me know if that makes sense as we end up having to very similar changes to do here, one for the link and another for the attachements.
Based on the new requirements, @Harshdeepjoshi 's proposal looks good to me.
cc: @sketchydroide Could you please also update the expected result according to https://github.com/Expensify/App/issues/9660#issuecomment-1178020405
🎀 👀 🎀 C+ reviewed
Yeah, I reported it a few days back https://expensify.slack.com/archives/C01GTK53T8Q/p1656707539152899 and will handle this separately.
@roryabraham Do we want to hide this menu option from attachments as well? I think we should.
Proposal
Solution
To hide the menu options from context menu for links, we need to edit this line and add
=> type === CONTEXT_MENU_TYPES.REPORT_ACTIONTo hide the menu options from context menu for attachments, we would add
&& !ReportUtils.isReportMessageAttachment(lodashGet(reportAction, ['message', 0], {}))to the same line and this will solve our issue.The final code will look like this
Links
Attachments
@roryabraham any thoughts? And can you advise on how we could disable the option to “Copy link” when we are right-clicking on a hyperlink?
I’m not sure where in the code we’d be able to do that (looked for a bit, but couldn’t find the logic that determines why some options show and others do not). That would be an easier solution IMO as it is pretty ambiguous what is even being copied when presented with these options:
bumping convo here - https://expensify.slack.com/archives/C02NK2DQWUX/p1657128025924389?thread_ts=1656925799.345049&cid=C02NK2DQWUX
also this still needs to get the
Help Wantedlabel first.@jayeshmangwani I don’t think that is what we are looking for, the
Copy linkis not the link of the url for that we haveCopy URL to clipboard.Copy linkis a link of the chat comment itself. the entire line. Like if you want to share that post with someone else