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-09-04] [$1000] Web - Money request - Copy to clipboard button does not copy content of an IOU edit comment #24569

Closed
1 of 6 tasks
izarutskaya opened this issue Aug 15, 2023 · 55 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 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@izarutskaya
Copy link

izarutskaya commented Aug 15, 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. Make money request from account A to account B
  2. Click on the IOU preview component twice
  3. Click on the amount and change it
  4. Hover over the posted comment and click on copy to clipboard
  5. Paste the content elsewhere

Expected Result:

The content should be copied when clicking on the copy to clipboard icon

Actual Result:

Nothing gets copied when clicking the copy to clipboard icon

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: v1.3.54-7

Reproducible in staging?: Y

Reproducible in production?: N

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

-14993053652749344022023-08-14_23_41_07.MP4
Recording.1201.mp4

Expensify/Expensify Issue URL:

Issue reported by: @Nathan-Mulugeta

Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1692045636871669

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~015fd8284ce80abac6
  • Upwork Job ID: 1691425057366032384
  • Last Price Increase: 2023-08-15
  • Automatic offers:
    • hungvu193 | Contributor | 26158030
    • Nathan-Mulugeta | Reporter | 26158033
@izarutskaya izarutskaya added DeployBlockerCash This issue or pull request should block deployment Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 15, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 15, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 15, 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

@OSBotify
Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open StagingDeployCash deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@melvin-bot
Copy link

melvin-bot bot commented Aug 15, 2023

Triggered auto assignment to @pecanoro (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@hungvu193
Copy link
Contributor

hungvu193 commented Aug 15, 2023

Proposal

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

Web - Money request - Copy to clipboard button does not copy content of an IOU edit comment

What is the root cause of that problem?

We're using this code below to copy message to clipboard, since we introduced new type of reportAction called "MODIFIEDEXPENSE", we didn't format it before copying, which caused the issue

const isAttachment = _.has(reportAction, 'isAttachment') ? reportAction.isAttachment : ReportUtils.isReportMessageAttachment(message);
if (!isAttachment) {
const content = selection || messageHtml;
if (isReportPreviewAction) {
const iouReport = ReportUtils.getReport(ReportActionUtils.getIOUReportIDFromReportActionPreview(reportAction));
const displayMessage = ReportUtils.getReportPreviewMessage(iouReport, reportAction);
Clipboard.setString(displayMessage);
} else if (content) {
const parser = new ExpensiMark();
if (!Clipboard.canSetHtml()) {
Clipboard.setString(parser.htmlToMarkdown(content));
} else {
const plainText = parser.htmlToText(content);
Clipboard.setHtml(content, plainText);
}
}
} else {
Clipboard.setString(messageHtml);
}

Screenshot 2023-08-15 at 17 47 15

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

We should update our copy to clip board action, if it's isModifiedExpenseAction, we should format the message before copying by adding more condition here:

else if (ReportActionUtils.isModifiedExpenseAction(reportAction)) {
const displayMessage = ReportUtils.getModifiedExpenseMessage(reportAction);
Clipboard.setString(displayMessage);
}

We should also update our shouldShow condition of copyToClipboard to make it show with ReportPreview TaskPreview:

    shouldShow: (type, reportAction) =>
        type === CONTEXT_MENU_TYPES.REPORT_ACTION &&
        reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.TASKCANCELLED &&
        reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED &&
        reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.TASKREOPENED &&
        !ReportUtils.isReportMessageAttachment(_.last(lodashGet(reportAction, ['message'], [{}]))) &&
        !ReportActionUtils.isMessageDeleted(reportAction),

In order to show copy option with task, we can also remove these three condition from above condition:

        reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.TASKCANCELLED &&
        reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED &&
        reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.TASKREOPENED &&

What alternative solutions did you explore? (Optional)

N/A

@melvin-bot melvin-bot bot added Daily KSv2 and removed Hourly KSv2 labels Aug 15, 2023
@dukenv0307
Copy link
Contributor

dukenv0307 commented Aug 15, 2023

Proposal

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

Web - Money request - Copy to clipboard button does not copy content of an IOU edit comment

What is the root cause of that problem?

  1. For preview action

We hide the copy option for TaskPreview and IOU Preview

shouldShow: (type, reportAction) =>
type === CONTEXT_MENU_TYPES.REPORT_ACTION &&
reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.IOU &&
reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.TASKCANCELLED &&
reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED &&
reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.TASKREOPENED &&
!ReportActionUtils.isCreatedTaskReportAction(reportAction) &&
!ReportUtils.isReportMessageAttachment(_.last(lodashGet(reportAction, ['message'], [{}]))) &&
!ReportActionUtils.isMessageDeleted(reportAction),

  1. For ModifiedExpenseMessage, the message display is generated by getModifiedExpenseMessage function.

children = <ReportActionItemBasicMessage message={ReportUtils.getModifiedExpenseMessage(props.action)} />;

But when we click on copyToClipBorad, we don't check to get modified expense message if the action is ModifiedExpenseAction action

if (isReportPreviewAction) {
const iouReport = ReportUtils.getReport(ReportActionUtils.getIOUReportIDFromReportActionPreview(reportAction));
const displayMessage = ReportUtils.getReportPreviewMessage(iouReport, reportAction);
Clipboard.setString(displayMessage);
} else if (content) {
const parser = new ExpensiMark();

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

  1. We should update the check to show copy option for IOUPreview and TaskPreview as well
type === CONTEXT_MENU_TYPES.REPORT_ACTION &&
reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.TASKCANCELLED &&
reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED &&
reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.TASKREOPENED &&
!ReportUtils.isReportMessageAttachment(_.last(lodashGet(reportAction, ['message'], [{}]))) &&
!ReportActionUtils.isMessageDeleted(reportAction),

shouldShow: (type, reportAction) =>
type === CONTEXT_MENU_TYPES.REPORT_ACTION &&
reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.IOU &&
reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.TASKCANCELLED &&
reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED &&
reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.TASKREOPENED &&
!ReportActionUtils.isCreatedTaskReportAction(reportAction) &&
!ReportUtils.isReportMessageAttachment(_.last(lodashGet(reportAction, ['message'], [{}]))) &&
!ReportActionUtils.isMessageDeleted(reportAction),

and then we can add the case to get the message of this preview action in onPress function of copy option and create a function to get the display message same as ReportPreview

if (isReportPreviewAction) {
const iouReport = ReportUtils.getReport(ReportActionUtils.getIOUReportIDFromReportActionPreview(reportAction));
const displayMessage = ReportUtils.getReportPreviewMessage(iouReport, reportAction);
Clipboard.setString(displayMessage);
} else if (content) {
const parser = new ExpensiMark();

2. We should update the copy to clip board action if the action is ModifiedExpenseAction we should get the message by getModifiedExpenseMessage function instead of getting this from action

if (isReportPreviewAction) {
const iouReport = ReportUtils.getReport(ReportActionUtils.getIOUReportIDFromReportActionPreview(reportAction));
const displayMessage = ReportUtils.getReportPreviewMessage(iouReport, reportAction);
Clipboard.setString(displayMessage);
} else if (content) {
const parser = new ExpensiMark();

And we also update the translation for Modified Expense Message

What alternative solutions did you explore? (Optional)

We can hide the copyToClipboard if the action is ModifiedExpenseAction

@BhuvaneshPatil
Copy link
Contributor

The link to github issue shall be posted in slack thread!

@pecanoro
Copy link
Contributor

Discussing internally since it's a new feature!

@mountiny mountiny removed the DeployBlockerCash This issue or pull request should block deployment label Aug 15, 2023
@mountiny
Copy link
Contributor

I think this needs to be fixed, but its not a deploy blocker.

@dukenv0307
Copy link
Contributor

@mountiny Can you confirm the expected here? We should hide copy option or fix to copy the current message.

@0xmiros
Copy link
Contributor

0xmiros commented Aug 15, 2023

If this is not a deploy blocker, I think better to merge this into #22387 for consistency.
There's open discussion but no one responded yet.

@mountiny
Copy link
Contributor

Its not a deploy blocker and I would expect the behaviour to be copying what you can see on the line

@pecanoro
Copy link
Contributor

@0xmiroslav I can't reproduce the issue you linked so I closed it since it's pretty old.

Regarding this issue, I talked to @mountiny and we decided not to block on this and have a contributor fix it!

@pecanoro pecanoro added the External Added to denote the issue can be worked on by a contributor label Aug 15, 2023
@melvin-bot melvin-bot bot changed the title Web - Money request - Copy to clipboard button does not copy content of an IOU edit comment [$1000] Web - Money request - Copy to clipboard button does not copy content of an IOU edit comment Aug 15, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 15, 2023

Job added to Upwork: https://www.upwork.com/jobs/~015fd8284ce80abac6

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 Daily KSv2 labels Sep 4, 2023
@flaviadefaria
Copy link
Contributor

Payment summary:

@hungvu193 requires payment offer (Contributor)
@narefyev91 does not require payment (Contractor)
@Nathan-Mulugeta requires payment offer (Reporter)

@Nathan-Mulugeta = $250 reporting bonus
@hungvu193 = $1000 (no 50% bonus)

@narefyev91 can you please fill out the checklist above?

@narefyev91
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR - no linked PR because it's a new implementation - no one implement fix for that flow
  • 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: N/A
  • 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: N/A
  • Determine if we should create a regression test for this bug - N/A

@parasharrajat
Copy link
Member

@narefyev91 @hungvu193 Please check this #26664 as it seems that PR didn't solve all cases. Let me know if you disagree. Thanks.

@hungvu193
Copy link
Contributor

@narefyev91 @hungvu193 Please check this #26664 as it seems that PR didn't solve all cases. Let me know if you disagree. Thanks.

I don't think so, actually we still have the logic getting the messageHtml from message.html, task action is a special case when it didn't have html field. I feel like this more a BE issue when the message got updated while originalMessage didn't.

@parasharrajat
Copy link
Member

parasharrajat commented Sep 7, 2023

Thanks. I looked into this and yet both are different issues. technically out of scope of this issue.

@parasharrajat
Copy link
Member

parasharrajat commented Sep 7, 2023

I debugged the other issue and I found that the #26664 is in fact related to this issue. We used originalMessage to copy the string in IOU which is the wrong thing to copy as a transaction can change.

But I wouldn't force that here.

@parasharrajat
Copy link
Member

parasharrajat commented Sep 7, 2023

Same for #26571.

We didn't set the proper data which should have been copied for Task Preview.

@parasharrajat
Copy link
Member

parasharrajat commented Sep 7, 2023

All of these previews should have been fixed as mentioned in #22387 (comment)

@pecanoro Do you consider #26664 & #26571 regressions from this issue or should we tackle them separately?

@0xmiros
Copy link
Contributor

0xmiros commented Sep 7, 2023

#26571 was reported on Aug 25
#26664 was reported on Aug 25
So they were both reported within regression period when PR was deployed to staging but not production

@parasharrajat
Copy link
Member

Bump @pecanoro

@melvin-bot
Copy link

melvin-bot bot commented Sep 11, 2023

@pecanoro, @hungvu193, @narefyev91, @flaviadefaria Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot added the Overdue label Sep 11, 2023
@pecanoro
Copy link
Contributor

Sorry! Yes, it seems like a regression, but only one regression as it's basically the same bug with the same cause. Let's fix it so it copies the updated field.

@melvin-bot melvin-bot bot removed the Overdue label Sep 11, 2023
@flaviadefaria
Copy link
Contributor

Alright payment is on hold until the regression has been fixed.

@parasharrajat
Copy link
Member

I am still waiting on some sort of confirmation from the author or C+ that the linked issues will be solved as regressions.

@narefyev91
Copy link
Contributor

I am still waiting on some sort of confirmation from the author or C+ that the linked issues will be solved as regressions.

To be honest the changes should be done on BE side and correct string should come from it, and as I see from this comment #26621 (comment) - BE team will implement localisation on their side - and on FE we will avoid all this tricks to make it working correctly. But if we come back to initial issue - i agree that fix was not covering all possible cases

@melvin-bot melvin-bot bot added the Overdue label Sep 14, 2023
@pecanoro
Copy link
Contributor

@narefyev91 That's a different issue, the translations are not related to the regression and should not be considered as such since it's the BE. Rajat linked another issue #26571.

@flaviadefaria Let's pay the issue with one regression, the other contributor is fixing them in their PR.

@melvin-bot melvin-bot bot removed the Overdue label Sep 14, 2023
@flaviadefaria
Copy link
Contributor

@hungvu193 requires payment offer (Contributor)
@narefyev91 does not require payment (Contractor)
@Nathan-Mulugeta requires payment offer (Reporter)

Payment Summary:

@Nathan-Mulugeta = $250 (Reporting bonus)
@hungvu193 = $1000 (no 50% bonus) - 50% (regression) = $500

@flaviadefaria
Copy link
Contributor

Everyone has been paid and since the regression is being fixed in another issue I'll close this one.

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 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests