-
Notifications
You must be signed in to change notification settings - Fork 3k
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-10-09] [$500] A new tab opens when downloading offline #26258
Comments
Triggered auto assignment to @tjferriss ( |
Bug0 Triage Checklist (Main S/O)
|
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. |
📣 @jjmilad! 📣
|
ProposalPlease 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. App/src/libs/fileDownload/index.js Lines 40 to 44 in 10ad0cb
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. App/src/components/AttachmentModal.js Line 342 in 6e17b64
And update this line to: shouldShowDownloadButton={props.allowDownload && shouldShowDownloadButton && !isOffline}
Result: Monosnap.screencast.2023-08-30.17-55-58.mp4 |
ProposalPlease 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?
download-button-disabled.movWhat alternative solutions did you explore? (Optional) |
ProposalPlease 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?
Need to add this code to under components App/src/components/AttachmentModal.js Line 339 in 4675db5
What alternative solutions did you explore? (Optional) |
@tjferriss Eep! 4 days overdue now. Issues have feelings too... |
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. |
Job added to Upwork: https://www.upwork.com/jobs/~0159b5b921ce8fa955 |
Current assignee @tjferriss is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @fedirjh ( |
Thanks everyone for the proposal. @Krishna2323, @paultsimura the root cause part needs further investigation. @yh-0218 your explanation for the root cause is logical but it needs further investigation. I would like to note that the source of the attachment in fullscreen differs from that in the report, hence your solution is not valid. |
ProposalPlease state again the problem we are trying to solve in this issue.A new tab opens when downloading an attachment offline. What is the cause of this issue?When we click download button on context menu or attachment modal, App/src/libs/fileDownload/index.js Line 10 in 10ad0cb
In fileDownload function, if file could not be downloaded, then open url in new tab.App/src/libs/fileDownload/index.js Lines 40 to 44 in 10ad0cb
What changes do you think we should make to solve the problem?We should disable download button on context menu and attachment modal if offline. return isAttachment && message.html !== CONST.ATTACHMENT_UPLOADING_MESSAGE_HTML && reportAction.reportActionID && !ReportActionsUtils.isMessageDeleted(reportAction) && !NetworkStore.isOffline(); In shouldShowDownloadButton={props.allowDownload && shouldShowDownloadButton && !NetworkStore.isOffline()} Or in shouldShowDownloadButton={props.allowDownload && shouldShowDownloadButton && !isOffline} const {isOffline} = useNetwork(); What alternative solutions have you investigated? (Optional)None. |
ProposalPlease 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?On pressing download button function App/src/components/AttachmentModal.js Line 343 in ce6b056
Which calls the App/src/components/AttachmentModal.js Lines 162 to 168 in ce6b056
Which on web, when download fails opens the download in new tab: App/src/libs/fileDownload/index.js Lines 40 to 44 in ce6b056
What changes do you think we should make in order to solve the problem?The We can check network conditions before starting the download flow. Solution 1:
Solution 2:
What alternative solutions did you explore? (Optional)xx |
ProposalPlease 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?This line causes the link to open in a new tab. App/src/libs/fileDownload/index.js Line 42 in c8dc57f
Prior to this PR (#24547), we used to display a growl notification when redirecting the user to an external link. However, with this PR, it was decided that we no longer want to prevent users from navigating to external links when we are in offline mode.
What changes do you think we should make in order to solve the problem?
In my opinion (IMO), I believe we should not hide the download button. Instead, we should display a growl notification if a user is offline and clicks on the download button. One approach could be to introduce an additional parameter in the openExternalLink function to handle cases where we want to show a growl notification in offline mode. Alternatively, we could make changes only within the .catch block to trigger the growl notification when in offline mode. What alternative solutions did you explore? (Optional) |
@tjferriss, @fedirjh Whoops! This issue is 2 days overdue. Let's get this updated quick! |
1 similar comment
@tjferriss, @fedirjh Whoops! This issue is 2 days overdue. Let's get this updated quick! |
@tjferriss In reference to your statement, how should we convey this information to the user? We have a proposal that suggests the re-implementation of the growl notification which I think is being deprecated. Other proposals suggest that we hide the download button in offline mode. So far we have :
|
📣 @fedirjh 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app! |
❌ There was an error making the offer to @StevenKKC for the Contributor role. The BZ member will need to manually hire the contributor. cc @thienlnam |
📣 @daveSeife 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app! |
@StevenKKC can you please manually apply to the job posting here: https://www.upwork.com/ab/applicants/1699136998481727488/job-details |
|
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.
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:
|
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:
|
Payment summary:
Eligible for 50% speed bonus |
@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? |
@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. |
Thank you @tjferriss I submit proposal with my friend's account. |
@StevenKKC I just sent an offer to your friend. |
BugZero Checklist:
Regression Test Proposal
|
All payments have been sent via Upworks and the regression test has been proposed. |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Action Performed:
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?
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
The text was updated successfully, but these errors were encountered: