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][$500] Chat - Action menu for MP4 files has "Copy to clipboard" and "Edit comment" functions #35578

Closed
5 of 6 tasks
kbecciv opened this issue Feb 1, 2024 · 47 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 Reviewing Has a PR in review

Comments

@kbecciv
Copy link

kbecciv commented Feb 1, 2024

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


Version Number: v1.4.35-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:

Pre-requisite: user must be logged in.

  1. Go to any chat.
  2. Send a MP4 file.
  3. Right click on it for the action menu to appear

Expected Result:

"Copy to clipboard" and "Edit comment" should not be options for MP4 files.

Actual Result:

"Copy to clipboard" and "Edit comment" are functions available for MP4 files. When edited, the file is no longer available.

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 evidences>

Recording.5972.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01bd7a8a1a0e4bc08b
  • Upwork Job ID: 1753109564515966976
  • Last Price Increase: 2024-02-01
  • Automatic offers:
    • DylanDylann | Reviewer | 0
    • Tony-MK | Contributor | 0
@kbecciv kbecciv 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 Feb 1, 2024
Copy link

melvin-bot bot commented Feb 1, 2024

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

@melvin-bot melvin-bot bot changed the title Chat - Action menu for MP4 files has "Copy to clipboard" and "Edit comment" functions [$500] Chat - Action menu for MP4 files has "Copy to clipboard" and "Edit comment" functions Feb 1, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 1, 2024
Copy link

melvin-bot bot commented Feb 1, 2024

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

Copy link

melvin-bot bot commented Feb 1, 2024

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

@kbecciv
Copy link
Author

kbecciv commented Feb 1, 2024

We think that this bug might be related to #vip-vsb
CC @quinthar

@ikevin127
Copy link
Contributor

ikevin127 commented Feb 1, 2024

Proposal

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

"Copy to clipboard" and "Edit comment" are functions should not be available for MP4 files.
When edited, the file is no longer available.

What is the root cause of that problem?

The issue here is that for the context menu actions we don't check the attachment type so we can show / hide these actions depending on the attachment type.

Within ContextMenuActions, for every action we have a shouldShow prop where this check is currently missing for the mentioned file types.

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

We should add logic similar to isVideo from FileUtils to check for the attachment types within ContextMenuActions and display the actions accordingly.

For this we should agree on an array of attachment file types and apply a ReportUtils lib where we're checking within reportAction.attachmentInfo.type against the array and if the file type exists we don't show the action.
We will apply this within ContextMenuActions for both the edit and copy to clipboard actions.

Videos

MacOS: Chrome / Safari
Before After
Screen.Recording.2024-02-01.at.19.58.06.mov
Screen.Recording.2024-02-01.at.20.00.00.mov

@Krishna2323
Copy link
Contributor

Krishna2323 commented Feb 1, 2024

Proposal

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

Chat - Action menu for MP4 files has "Copy to clipboard" and "Edit comment" functions.

What is the root cause of that problem?

In isReportActionAttachment we don't check for attachmentInfo existence before returning a value for isReportActionAttachment and in edit action we don't use isReportActionAttachment check.

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

We should also check for attachmentInfo property in reportAction before returning a value for isReportActionAttachment.

    if (reportAction && 'attachmentInfo' in reportAction) {
        return true;
    }

In isReportActionAttachment util function.

function isReportActionAttachment(reportAction: OnyxEntry<ReportAction>): boolean {
const message = reportAction?.message?.[0];
if (reportAction && 'isAttachment' in reportAction) {
return reportAction.isAttachment ?? false;
}
if (message) {
return isReportMessageAttachment(message);
}
return false;
}

This property always exists on attachments.

Use isReportActionAttachment for editAction also instead of replacing isReportMessageAttachment with isReportActionAttachment in canEditReportAction.

Or add isReportActionAttachment check in canEditReportAction

Result

@mkhutornyi
Copy link
Contributor

I think this should be fixed in backend.
Backend is sending file name in text property for some reason. It should be [Attachment]

@Krishna2323
Copy link
Contributor

@mkhutornyi, yeah its a backend issue, the isAttachment property is also returned as false from the backend.

@Tony-MK
Copy link
Contributor

Tony-MK commented Feb 1, 2024

Proposal

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

Chat - Action menu for MP4 files has "Copy to clipboard" and "Edit comment" functions

What is the root cause of that problem?

The root cause of the problem is that we use isReportMessageAttachment in canEditReportAction and the first condition seen below will fail because text is the video's filename.

const regex = new RegExp(` ${CONST.ATTACHMENT_SOURCE_ATTRIBUTE}="(.*)"`, 'i');
return text === CONST.ATTACHMENT_MESSAGE_TEXT && (!!html.match(regex) || html === CONST.ATTACHMENT_UPLOADING_MESSAGE_HTML);

Screenshot 2024-02-01 at 22 09 38

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

  1. Switch isReportMessageAttachment with isReportActionAttachment in the canEditReportAction function.

  2. Check for reportAction.attachmentInfo in the isReportActionAttachment because reportAction.isAttachment is false.

if (reportAction && ('isAttachment' in reportAction || 'attachmentInfo' in reportAction)) {
    return  !!(reportAction?.attachmentInfo ?? reportAction.isAttachment);
}

What alternative solutions did you explore? (Optional)

We could ignore step 1 and only execute step 2 in the isReportMessageAttachment function.

@melvin-bot melvin-bot bot added the Overdue label Feb 5, 2024
@DylanDylann
Copy link
Contributor

DylanDylann commented Feb 5, 2024

I will review it tomorrow

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

melvin-bot bot commented Feb 5, 2024

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

@DylanDylann
Copy link
Contributor

Waiting for more proposal

@Krishna2323
Copy link
Contributor

Unhidden my initial proposal if this needs to be fixed on frontend.
@DylanDylann, tagging you for a review.

@Tony-MK
Copy link
Contributor

Tony-MK commented Feb 8, 2024

Hi @DylanDylann, I updated my proposal.
Could you review it?
Thanks

@DylanDylann
Copy link
Contributor

Thanks for everyone. @Krishna2323's proposal doesn't fix this issue completely (miss "Edit comment" option). @Tony-MK's proposal looks good to me

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Feb 8, 2024

Triggered auto assignment to @srikarparsi, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@Krishna2323
Copy link
Contributor

Krishna2323 commented Feb 8, 2024

@DylanDylann, I don't think we should modify isReportMessageAttachment with isReportActionAttachment in the canEditReportAction function, because canEditReportAction is also used in ReportScreen and isReportMessageAttachment is different from isReportActionAttachment.

Also I think my proposal was the first to identify the correct root cause and provide a solution, though I accidentally deleted the point for adding that check for edit case also but I think it's very minor thing to select a proposal, that would have been checked during the PR as it has been also included in the expected outcome. Thanks

@Krishna2323
Copy link
Contributor

In isReportActionAttachment we don't check for attachmentInfo existence before returning a value for isReportActionAttachment and in edit action we don't use isReportActionAttachment check.

hey @DylanDylann, I deleted the edit action point from my solution by mistake but I think I still have it in the root cause section😅. So I think my proposal is still the first with the correct solution.

@DylanDylann
Copy link
Contributor

because canEditReportAction is also used in ReportScreen and isReportMessageAttachment is different from isReportActionAttachment.

I don't see any problem with modifying isReportMessageAttachment with isReportActionAttachment in the canEditReportAction function

@Krishna2323
Copy link
Contributor

Krishna2323 commented Feb 8, 2024

I do think it may cause regression, but even if it do not, I think switching isReportMessageAttachment with isReportActionAttachment in the canEditReportAction function is same as adding isReportActionAttachment check in edit action.

Thanks for everyone. @Krishna2323's #35578 (comment) doesn't fix this issue completely (miss "Edit comment" option).

Also you missed the "Edit comment" option point in my root cause.

and in edit action we don't use isReportActionAttachment check.

Can you pls re-evaluate proposals 🙏🏻

cc: @srikarparsi

Copy link

melvin-bot bot commented Feb 12, 2024

@Tony-MK, @srikarparsi, @kadiealexander, @DylanDylann Whoops! This issue is 2 days overdue. Let's get this updated quick!

@kadiealexander
Copy link
Contributor

Not overdue, being worked on in the PR.

@melvin-bot melvin-bot bot removed the Overdue label Feb 13, 2024
@DylanDylann
Copy link
Contributor

@Tony-MK any update on the PR

Copy link

melvin-bot bot commented Feb 15, 2024

@Tony-MK @srikarparsi @kadiealexander @DylanDylann this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@Tony-MK
Copy link
Contributor

Tony-MK commented Feb 15, 2024

Sorry for the delay, @DylanDylann.

I am having issues testing android - mWeb.

However, I should be done by tomorrow.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Feb 15, 2024
Copy link

melvin-bot bot commented Feb 20, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@mkhutornyi
Copy link
Contributor

@Tony-MK can you please confirm your PR will fix #36828 as well?

@techievivek
Copy link
Contributor

techievivek commented Feb 20, 2024

@srikarparsi It seems like the backend is returning the original filename instead of the [Attachment] text. Were you able to look into it? There is also a comment from @mkhutornyi regarding the same: #35578 (comment).

CC @francoisl since you were involved with this project. 🙇

Also, it would be great to have this fixed as quickly as possible @DylanDylann @Tony-MK, since we had another issue created today that was marked as deploy blocker #36828.

Copy link

melvin-bot bot commented Feb 20, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@DylanDylann
Copy link
Contributor

@Tony-MK Please help to speed up our PR, because our PR will fix other deploy blocker issues

@Tony-MK
Copy link
Contributor

Tony-MK commented Feb 20, 2024

@DylanDylann Sorry for the delay. Let's finish the PR.

@francoisl
Copy link
Contributor

It seems like the backend is returning the original filename instead of the [Attachment] text. Were you able to look into it? There is also a comment from

@techievivek I'm working on this already, we also need to make the backend return [Attachment] for the lastMessageText value when uploading a video.

@techievivek
Copy link
Contributor

Ok great, thanks for confirming @francoisl 🙇

@DylanDylann
Copy link
Contributor

@kadiealexander The PR was deployed to production 2 weeks ago. Please help to process the next step

@kadiealexander
Copy link
Contributor

kadiealexander commented Mar 12, 2024

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:

  • [@DylanDylann] The PR that introduced the bug has been identified. Link to the PR: NA
  • [@DylanDylann] 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: NA
  • [@DylanDylann] 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: NA
  • [@DylanDylann] Determine if we should create a regression test for this bug. Yes
  • [@DylanDylann] 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: https://github.com/Expensify/Expensify/issues/379066

@kadiealexander
Copy link
Contributor

kadiealexander commented Mar 12, 2024

Payouts due:

Upwork job is here.

@kadiealexander kadiealexander changed the title [$500] Chat - Action menu for MP4 files has "Copy to clipboard" and "Edit comment" functions [Hold for payment][$500] Chat - Action menu for MP4 files has "Copy to clipboard" and "Edit comment" functions Mar 12, 2024
@kadiealexander kadiealexander added Daily KSv2 and removed Weekly KSv2 labels Mar 12, 2024
@DylanDylann
Copy link
Contributor

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:

[@DylanDylann] The PR that introduced the bug has been identified. Link to the PR: NA
[@DylanDylann] 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: NA
[@DylanDylann] 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: NA
[@DylanDylann] Determine if we should create a regression test for this bug. Yes
[@DylanDylann] 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.

Regression Test Proposal

  1. Go to a chat that has a video that was not uploaded by the device.
  2. Open the video's context menu by holding down or left-click.
  3. Verify that "Download" is a menu option.
  4. Verify "Copy to clipboard" and "Edit comment" are not menu options.
  5. Upload a video.
  6. Open the video's context menu by holding down or left-click.
  7. Verify that "Download" is a menu option.
  8. Verify "Copy to clipboard" and "Edit comment" are not menu options.

Do we agree 👍 or 👎

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 Reviewing Has a PR in review
Projects
None yet
Development

No branches or pull requests

10 participants