Skip to content

[HOLD for payment 2023-10-09] [$500] A new tab opens when downloading offline #26258

Closed

Description

@kavimuru

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. From user A, Send an attachment to user B.
  2. Be offline for user B before opening the attachment
  3. Click on the attachment sent from User A
  4. Click on the download button at the top

Expected Result:

the inactive download button is shown.

Actual Result:

A new tab is opened

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

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.58-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
Notes/Photos/Videos: Any additional supporting documentation

T117-1.mp4
Recording.1530.mp4

Expensify/Expensify Issue URL:
Issue reported by: @daveSeife
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1692409444867919

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0159b5b921ce8fa955
  • Upwork Job ID: 1699136998481727488
  • Last Price Increase: 2023-09-19
  • Automatic offers:
    • fedirjh | Reviewer | 26848952
    • daveSeife | Reporter | 26848953

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 29, 2023
  2. melvin-bot commented on Aug 29, 2023

    @melvin-bot

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

  3. melvin-bot commented on Aug 29, 2023

    @melvin-bot

    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
  4. jjmilad commented on Aug 29, 2023

    @jjmilad

    Hello, my idea is to make the download button inactive when the user is offline. We could make an event listener when the pop-up is injected in the code to get the network status of the user.

  5. melvin-bot commented on Aug 29, 2023

    @melvin-bot

    📣 @jjmilad! 📣
    Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
    Please follow these steps:

    1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
    2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
    3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
  6. Krishna2323 commented on Aug 30, 2023

    @Krishna2323
    Contributor

    Proposal

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

    A new tab opens when downloading offline

    What is the root cause of that problem?

    Download button is not hidden & we open external link of the attachment when download fails.

    .catch(() => {
    // file could not be downloaded, open sourceURL in new tab
    Link.openExternalLink(url);
    return resolve();
    });

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

    We can hide or disable the download button when user is offline, using isOffline state.
    const {isOffline} = useNetwork();

    shouldShowDownloadButton={props.allowDownload && shouldShowDownloadButton}

    And update this line to:
    shouldShowDownloadButton={props.allowDownload && shouldShowDownloadButton && !isOffline}

    Result:

    Monosnap.screencast.2023-08-30.17-55-58.mp4
  7. paultsimura commented on Aug 30, 2023

    @paultsimura
    Contributor

    Proposal

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

    When a user is offline, the "Download Attachment" button should be disabled instead of opening a new tab.

    What is the root cause of that problem?

    We do not handle the user's network status.

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

    1. For HeaderWithBackButton, along with shouldShowDownloadButton, add a boolean property shouldDisableDownloadButton

      shouldShowDownloadButton: PropTypes.bool,

    2. In HeaderWithBackButton, while rendering the PressableWithoutFeedback, pass the disabled property:

      <PressableWithoutFeedback

    <PressableWithoutFeedback
        ...
        disabled={shouldDisableDownloadButton}
    >
    
    1. Compose the AttachmentModal using withNetwork() and render <HeaderWithBackButton> with shouldDisableDownloadButton={props.network.isOffline}
    download-button-disabled.mov

    What alternative solutions did you explore? (Optional)

  8. yh-0218 commented on Aug 30, 2023

    @yh-0218
    Contributor

    Proposal

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

    When a user is offline, the "Download Attachment" button should be disabled instead of opening a new tab.

    What is the root cause of that problem?

    We do not handle the user's network status.
    But this is not correct problem.
    We have to allow user to download images that he received before.

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

    1. add a boolean property shouldDisableDownloadButton under shouldShowDownloadButton on HeaderWithBackButton

      shouldShowDownloadButton: PropTypes.bool,

    2. On HeaderWithBackButton, we need to add PressableWithoutFeedback as disable

      <PressableWithoutFeedback

    <PressableWithoutFeedback
        ...
        disabled={shouldDisableDownloadButton}
    >
    
    1. We don't need to check network status (because we have allow user to download old images without network).
    shouldDisableDownloadButton = {_.isEmpty(props.source)}
    

    Need to add this code to under components

    <HeaderWithBackButton

    What alternative solutions did you explore? (Optional)

  9. melvin-bot commented on Sep 4, 2023

    @melvin-bot

    @tjferriss Eep! 4 days overdue now. Issues have feelings too...

  10. tjferriss commented on Sep 5, 2023

    @tjferriss
    Contributor

    I'm able to reproduce. If we're able to download the attachment then we should. If not, then we'd want to somehow tell the user they need to go online to access the attachment.

  11. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Sep 5, 2023
  12. 47 remaining items

  13. melvin-bot commented on Oct 2, 2023

    @melvin-bot

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

  14. melvin-bot commented on Oct 2, 2023

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.75-12 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-10-09. 🎊

    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
  15. melvin-bot commented on Oct 2, 2023

    @melvin-bot

    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:

    • [@fedirjh] The PR that introduced the bug has been identified. Link to the PR:
    • [@fedirjh] 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:
    • [@fedirjh] 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:
    • [@fedirjh] Determine if we should create a regression test for this bug.
    • [@fedirjh] 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.
    • [@tjferriss] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  16. tjferriss commented on Oct 3, 2023

    @tjferriss
    Contributor

    Payment summary:

    Eligible for 50% speed bonus

  17. StevenKKC commented on Oct 3, 2023

    @StevenKKC
    Contributor

    @tjferriss I am afraid to let you know that My Upwork account is suspended so I couldn't get paid with my account. May I send proposal with my friend's account?

  18. tjferriss commented on Oct 3, 2023

    @tjferriss
    Contributor

    @StevenKKC that's fine. They can apply for the posting here: https://www.upwork.com/jobs/~0159b5b921ce8fa955.

    Please comment here with their name once they've applied.

  19. StevenKKC commented on Oct 4, 2023

    @StevenKKC
    Contributor

    Thank you @tjferriss I submit proposal with my friend's account.
    This is profile link: https://www.upwork.com/freelancers/~0188155b8a5d85a491

  20. tjferriss commented on Oct 5, 2023

    @tjferriss
    Contributor

    @StevenKKC I just sent an offer to your friend.

  21. fedirjh commented on Oct 9, 2023

    @fedirjh
    Contributor

    BugZero Checklist:

    • Link to the PR: This doesn’t seem to be a recent regression, The code for opening the new tab was present for over 2 years.
    • Link to discussion: N/A, There is Nothing we can add to the checklist, we should require a regression test for this bug.
    • Determine if we should create a regression test for this bug:

    Regression Test Proposal

    1. From user A, Send an attachment to user B.
    2. Be offline for user B before opening the attachment
    3. Hover over the attachment and open the context menu
    4. Verify that there is no download option in the context menu
    5. Click on the attachment to open it
    6. Verify that there is no download button at the attachment header
    7. Go online
    8. Verify that you can download the attachment from the context menu and from the attachment header
    • Do we agree 👍 or 👎
  22. tjferriss commented on Oct 11, 2023

    @tjferriss
    Contributor

    All payments have been sent via Upworks and the regression test has been proposed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions