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 2024-07-24][$250] mWeb/Safari - Attachments - New tab doesn't open when clicking the download button from the overflow menu on a .doc file #43857

Closed
1 of 6 tasks
lanitochka17 opened this issue Jun 17, 2024 · 35 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

@lanitochka17
Copy link

lanitochka17 commented Jun 17, 2024

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.84-2
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4636547
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause - Internal Team

Action Performed:

  1. Navigate to a conversation
  2. Upload a .doc attachment to the chat
  3. Long press the .doc attachment
  4. Click download

Expected Result:

Download starts on a new tab

Actual Result:

Download starts on the same tab

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

Bug6516195_1718645800178.IMG_9378.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~018590692829acb48f
  • Upwork Job ID: 1802929010080656004
  • Last Price Increase: 2024-06-25
  • Automatic offers:
    • dukenv0307 | Contributor | 102939688
    • Krishna2323 | Contributor | 102961763
Issue OwnerCurrent Issue Owner: @dukenv0307
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 17, 2024
Copy link

melvin-bot bot commented Jun 17, 2024

Triggered auto assignment to @jliexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@lanitochka17
Copy link
Author

@jliexpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@lanitochka17
Copy link
Author

We think that this bug might be related to #vip-vsp

@jliexpensify
Copy link
Contributor

ios <> Android swapsies

@kadiealexander kadiealexander added the External Added to denote the issue can be worked on by a contributor label Jun 18, 2024
Copy link

melvin-bot bot commented Jun 18, 2024

Job added to Upwork: https://www.upwork.com/jobs/~018590692829acb48f

@melvin-bot melvin-bot bot changed the title mWeb/Safari - Attachments - New tab opens when clicking the download button on a .doc file [$250] mWeb/Safari - Attachments - New tab opens when clicking the download button on a .doc file Jun 18, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 18, 2024
Copy link

melvin-bot bot commented Jun 18, 2024

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

@Krishna2323
Copy link
Contributor

Krishna2323 commented Jun 18, 2024

Proposal

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

Opening a new tab is expected behaviour but it should be the same for context menu download button.

Inconsistency bug

safari_file_download_inconsistency.mp4

What is the root cause of that problem?

We are not passing the shouldOpenExternalLink parameter when downloading the attachment from context menu.

fileDownload(sourceURLWithAuth, originalFileName ?? '').then(() => Download.setDownload(sourceID, false));

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

We should check if the attachment html is link and pass the shouldOpenExternalLink parameter accordingly.

to:

const isLinkAttachment = html.startsWith('<a href');
fileDownload(sourceURLWithAuth, originalFileName ?? '', undefined, isLinkAttachment && Browser.isMobileSafari()).then(() => Download.setDownload(sourceID, false));

We should also check on other places where fileDownload is used.

What alternative solutions did you explore? (Optional)

@nkdengineer
Copy link
Contributor

Proposal

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

A new tab opens and the download starts

What is the root cause of that problem?

We pass shouldOpenExternalLink as true if the browser is safari. It's added to fix this issue #37131.

fileDownload(sourceURLWithAuth, displayName, '', Browser.isMobileSafari()).then(() => Download.setDownload(sourceID, false));

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

I think we don't need to open a new tab when downloading the file in mWeb safari.

fileDownload(sourceURLWithAuth, displayName, '').then(() => Download.setDownload(sourceID, false)); 

fileDownload(sourceURLWithAuth, displayName, '', Browser.isMobileSafari()).then(() => Download.setDownload(sourceID, false));

Instead, we will do nothing when clicking on the download button if a file is downloading in mWeb safari. To do that we can get all download collection and check we're downloading a file or not. Or we can create another Onyx key to know whether we download a file.

What alternative solutions did you explore? (Optional)

@DylanDylann
Copy link
Contributor

@nkdengineer Did you test your proposal with the previous problem? Please provide a test branch then I can ensure that there are no risks if we revert to the previous solution

@DylanDylann
Copy link
Contributor

DylanDylann commented Jun 19, 2024

@Krishna2323 Please keep your proposal consistent.

Please re-state the problem that we are trying to solve in this issue.
you said: "new tab open" is the problem that we are trying to solve in this issue

What changes do you think we should make in order to solve the problem?
you suggest: new tab should open when clicking download button on context menu"

Two these sections are conflict

@DylanDylann
Copy link
Contributor

@Krishna2323 One more thing

We should also check on other places where fileDownload is used.

Which places you want to mention here?

@Krishna2323
Copy link
Contributor

Krishna2323 commented Jun 19, 2024

@DylanDylann, I updated my proposal code snippet part. We also need to check if the attachment is a link or not before passing Browser.isMobileSafari().

Two these sections are conflict

In RCA section I explained the reason for the behaviour and inconsistency.

This is expected behaviour for mWeb safari, the behaviour was added in this #37131 to fix multiple issue in mWeb safari and desktop app, however it seems like we missed adding the same behaviour when downloading files from context menu.

I think we only need to make change for the context menu.

@DylanDylann
Copy link
Contributor

mWeb/Safari - Attachments - New tab opens when clicking the download button on a .doc file

This is not the problem you are trying to solve

@DylanDylann
Copy link
Contributor

DylanDylann commented Jun 19, 2024

@Krishna2323 In this section

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

Please re-state the problem you see and you are trying to resolve in your proposal. I don't see any value in this section when you copy the issue title. On the contrary, it confuses me

@Krishna2323
Copy link
Contributor

@DylanDylann, opening a new tab is expected behaviour and we should do the same when downloading from the attachment from context menu.

Please re-state the problem you see and you are trying to resolve in your proposal. I don't see any value in this section when you copy the issue title. On the contrary, it confuses me

Sorry for that, updated the proposal.

@nkdengineer
Copy link
Contributor

@DylanDylann The test branch here.

Copy link

melvin-bot bot commented Jun 24, 2024

@kadiealexander, @DylanDylann Eep! 4 days overdue now. Issues have feelings too...

@melvin-bot melvin-bot bot added the Overdue label Jun 24, 2024
@DylanDylann
Copy link
Contributor

@dukenv0307 will take this issue

@melvin-bot melvin-bot bot removed the Overdue label Jun 25, 2024
@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jul 1, 2024
@Expensify Expensify deleted a comment from melvin-bot bot Jul 1, 2024
@kadiealexander
Copy link
Contributor

@dukenv0307 sorry for the delay! Please take a look at the proposals.

@melvin-bot melvin-bot bot removed the Overdue label Jul 1, 2024
@dukenv0307
Copy link
Contributor

Thanks for all your proposals @nkdengineer @Krishna2323. I want to re-confirm the expectations.

  1. Opening the new tab seems to be the expected behavior according to this.
  2. But If users long press on the message, then click download, it doesn't open the new tab. Is it the expectation?

IMO, we should fix 2 to match 1 like @Krishna2323's proposal. (We can use REGEX_LINK_IN_ANCHOR to detect the anchor attachment)

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Jul 1, 2024

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

@dukenv0307
Copy link
Contributor

Pls let me know what your thought ^ @srikarparsi

Copy link

melvin-bot bot commented Jul 1, 2024

@srikarparsi @kadiealexander @dukenv0307 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!

@srikarparsi srikarparsi changed the title [$250] mWeb/Safari - Attachments - New tab opens when clicking the download button on a .doc file [$250] mWeb/Safari - Attachments - New tab doesn't open when clicking the download button from the overflow menu on a .doc file Jul 2, 2024
@srikarparsi
Copy link
Contributor

Yes, this sounds good. I updated the issue's title and description.

Copy link

melvin-bot bot commented Jul 2, 2024

📣 @Krishna2323 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@dukenv0307
Copy link
Contributor

Waiting for your PR @Krishna2323

@Krishna2323
Copy link
Contributor

Will raise PR by end of tomorrow.

@Krishna2323
Copy link
Contributor

@dukenv0307, PR ready for review ^

@kadiealexander kadiealexander changed the title [$250] mWeb/Safari - Attachments - New tab doesn't open when clicking the download button from the overflow menu on a .doc file [HOLD for payment 2024-06-24][$250] mWeb/Safari - Attachments - New tab doesn't open when clicking the download button from the overflow menu on a .doc file Jul 19, 2024
@kadiealexander kadiealexander changed the title [HOLD for payment 2024-06-24][$250] mWeb/Safari - Attachments - New tab doesn't open when clicking the download button from the overflow menu on a .doc file [HOLD for payment 2024-07-24][$250] mWeb/Safari - Attachments - New tab doesn't open when clicking the download button from the overflow menu on a .doc file Jul 26, 2024
@kadiealexander
Copy link
Contributor

kadiealexander commented Jul 26, 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:

  • [@dukenv0307] The PR that introduced the bug has been identified. Link to the PR: N/A
  • [@dukenv0307] 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
  • [@dukenv0307] 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
  • [@dukenv0307] Determine if we should create a regression test for this bug.
  • [@dukenv0307] 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/417767

@kadiealexander
Copy link
Contributor

kadiealexander commented Jul 26, 2024

Payouts due:

Upwork job is here.

@kadiealexander kadiealexander added Daily KSv2 and removed Weekly KSv2 labels Jul 26, 2024
@dukenv0307
Copy link
Contributor

BugZero Checklist:

  • The PR that introduced the bug has been identified. Link to the PR: N/A
  • 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. Yes
  • 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 tests:

  1. Navigate to a conversation
  2. Upload a .doc attachment to the chat
  3. Long press the .doc attachment
  4. Click download
  5. Verify download option is opened in a new tab on mweb safari, for other platforms, the file is downloaded in this tab/screen

Do we 👍 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
No open projects
Archived in project
Development

No branches or pull requests

8 participants