Open izarutskaya opened 2 months ago
Triggered auto assignment to @anmurali (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.
We think this issue might be related to the #vip-vsb
The user is able to trigger a download when the file is already downloading.
In the Context menu, we do not display the Download button based on the download state. The file can be downloaded, and the download link will still appear on the context menu.
In BaseAnchorForAttachmentsOnly
, we have an isDownloading
variable used to prevent the click action on the file when downloading.
We can use the same isDownloading
variable and pass it to showContextMenuForReport
.
In ContextMenuActions
, we can add another condition to shouldShow
to prevent the display when isDownloading
.
@anmurali Huh... This is 4 days overdue. Who can take care of this?
Job added to Upwork: https://www.upwork.com/jobs/~015a422bd93974d7e4
Triggered auto assignment to Contributor-plus team member for initial proposal review - @situchan (External
)
The download button in the right-click menu is not disabled and the user can click continuously and download repeatedly.
In AnchorForAttachmentsOnly
as shown in the OP video https://github.com/Expensify/App/blob/c11ae2f8244bbef15c153bfaa8bb707a5d1ab645/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.tsx#L65
It will show the loading icon if the attachment is downloading, it will also do not allow further download trigger https://github.com/Expensify/App/blob/c11ae2f8244bbef15c153bfaa8bb707a5d1ab645/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.tsx#L48
However, we don't have any implementation to disable the Download
button in the report action context menu when the attachment is downloading https://github.com/Expensify/App/blob/c11ae2f8244bbef15c153bfaa8bb707a5d1ab645/src/pages/home/report/ContextMenu/ContextMenuActions.tsx#L504
Add implementation to disable the Download
button in the report action context menu when the attachment is downloading.
shouldDisable
for checking if the context menu item should be disabled
shouldDisable: (download) => {
return download?.isDownloading ?? false
}
const html = getActionHtml(reportAction);
const {sourceURL} = getAttachmentDetails(html);
const sourceID = (sourceURL?.match(CONST.REGEX.ATTACHMENT_ID) ?? [])[1];
const [download] = useOnyx(${ONYXKEYS.COLLECTION.DOWNLOAD}${sourceID}
);
(`getActionHtml` should be exported from `src/pages/home/report/ContextMenu/ContextMenuActions.tsx`)
- In https://github.com/Expensify/App/blob/c11ae2f8244bbef15c153bfaa8bb707a5d1ab645/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx#L289, use `shouldDisable`
disabled={contextAction?.shouldDisable ? contextAction?.shouldDisable(download) : false}
- Pass `ContextMenuItem` from `ContextMenuItem` to `FocusableMenuItem` https://github.com/Expensify/App/blob/c11ae2f8244bbef15c153bfaa8bb707a5d1ab645/src/components/ContextMenuItem.tsx#L137
disabled={disabled}
- Optional: Customize the cursor to be `cursor: wait` so it's clear it's disabled because it is loading. Or we can go further by customizing the icon of the `Download` context menu item to [use loading indicator](https://github.com/Expensify/App/blob/c11ae2f8244bbef15c153bfaa8bb707a5d1ab645/src/components/Attachments/AttachmentView/DefaultAttachmentView/index.tsx#L54) while the attachment is downloading. Like the [UX of AnchorForAttachmentsOnly](https://github.com/Expensify/App/blob/c11ae2f8244bbef15c153bfaa8bb707a5d1ab645/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.tsx#L48)
Result:
https://github.com/Expensify/App/assets/161821005/2e285dc9-003f-4589-b17c-602696eee01f
### What alternative solutions did you explore? (Optional)
Other UXs can be suggested: Changing the action menu text to `Downloading` when it's downloading, ...
The problem could exist in similar case such as mini context menu, ... can be fixed like described.
<!---
ATTN: Contributor+
You are the first line of defense in making sure every proposal has a clear and easily understood problem with a "root cause". Do not approve any proposals that lack a satisfying explanation to the first two prompts. It is CRITICALLY important that we understand the root cause at a minimum even if the solution doesn't directly address it. When we avoid this step we can end up solving the wrong problems entirely or just writing hacks and workarounds.
Instructions for how to review a proposal:
1. Address each contributor proposal one at a time and address each part of the question one at a time e.g. if a solution looks acceptable, but the stated problem is not clear then you should provide feedback and make suggestions to improve each prompt before moving on to the next. Avoid responding to all sections of a proposal at once. Move from one question to the next each time asking the contributor to "Please update your original proposal and tag me again when it's ready for review".
2. Limit excessive conversation and moderate issues to keep them on track. If someone is doing any of the following things please kindly and humbly course-correct them:
- Posting PRs.
- Posting large multi-line diffs (this is basically a PR).
- Skipping any of the required questions.
- Not using the proposal template at all.
- Suggesting that an existing issue is related to the current issue before a problem or root cause has been established.
- Excessively wordy explanations.
3. Choose the first proposal that has a reasonable answer to all the required questions.
-->
@devguest07 can you please share demo video after applying your solution?
If I understand correctly, @devguest07 suggested to hide Download button, while @nkdengineer suggested to disable Download button.
@Expensify/design which pattern is correct? hide or disable?
Hmm I would think we would replace the icon in the right click menu's Download row with a loading spinner as well.
That being said, this is an edge-case, I doubt real users are going to be doing this action.
Hmm I would think we would replace the icon in the right click menu's Download row with a loading spinner as well.
Yeah I'd say disable + replace icon with loading spinner. But I also agree with that this is an edge-case.
Yeah I'd say disable + replace icon with loading spinner.
@situchan Looks like everyone agrees to go with my suggestion, I think we're good to move forward here
Add implementation to disable the Download button in the report action context menu when the attachment is downloading.
Or we can go further by customizing the icon of the Download context menu item to use loading indicator while the attachment is downloading. Like the UX of AnchorForAttachmentsOnly
That being said, if we do decide to keep this one open, let's lower the bug bounty because it's such an edge case that not a single customer has ever reported yet.
@anmurali, @situchan Whoops! This issue is 2 days overdue. Let's get this updated quick!
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
disable + replace icon with loading spinner
@nkdengineer's proposal looks good based on expected behavior we discussed.
πππ C+ reviewed
Triggered auto assignment to @madmax330, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@madmax330 @anmurali @situchan 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!
@madmax330, @anmurali, @situchan Whoops! This issue is 2 days overdue. Let's get this updated quick!
π£ @situchan π An offer has been automatically sent to your Upwork account for the Reviewer role π Thanks for contributing to the Expensify app!
π£ @nkdengineer π 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 π
@situchan this PR is ready for review
Reviewing
label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 9.0.13-4 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2024-08-05. :confetti_ball:
For reference, here are some details about the assignees on this 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:
This issue has not been updated in over 15 days. @madmax330, @anmurali, @situchan, @nkdengineer eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
@madmax330, @anmurali, @situchan, @nkdengineer Whoops! This issue is 2 days overdue. Let's get this updated quick!
Waiting for payment cc: @anmurali
@madmax330, @anmurali, @situchan, @nkdengineer 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
@situchan can you please propose a regression test and otherwise complete the BZ checklist first? @nkdengineer is paid.
This is not regression but improvement. I think we can skip regression test as edge case.
@madmax330, @anmurali, @situchan, @nkdengineer Huh... This is 4 days overdue. Who can take care of this?
@madmax330, @anmurali, @situchan, @nkdengineer 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
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.82-0 Reproducible in staging?: Y Reproducible in production?: Y Email or phone of affected tester (no customers): nhut.nguyenminh.it+dt002@gmail.com Logs: https://stackoverflow.com/c/expensify/questions/4856 Issue reported by: Applause-Internal team
Action Performed:
Expected Result:
When the file is being downloaded, the download button inside the right-click menu must also be disabled to avoid users being able to click repeatedly to download the file.
Actual Result:
When clicking download, the download button will change to a loading button and the user cannot click on it, however, the download button in the right-click menu is not disabled and the user can click continuously and download repeatedly.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
https://github.com/Expensify/App/assets/115492554/54cea47a-d9dc-4eaa-a69b-37724419d589
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @anmurali