You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD - #21977] Web - Users can download attachments when viewing attachment previews as anonymous users #22638
HOVER on any attached image in the chat room and click Download option on the context menu
Observer: User is UNABLE to download the image and re-directed to Login page
Open that room at step 2 again and CLICK on any attached image
Click download button on the Attachment preview
Observer: User is now ABLE to download the image - this is opposite to the behavior at step 3
Expected Result:
The behavior of the download attachment function should be consistent between the context menu and attachment preview.
Actual Result:
Users are unable to download attachments from the context menu, but they are able to download them from the attachment preview.
Workaround:
Unknown
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.39-5 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
What changes do you think we should make in order to solve the problem?
Add a function to check whether or not the user is anonymous:
If the user is anonymous: Re-direct user to Signin page
If the user is already logged in: Trigger desired action - which is to download the attachment
/**
* Checks if user is anonymous. If true, hides the context menu and
* shows the sign in modal. Else, executes the callback.
*
* @param {Function} callback
*/
const interceptAnonymousUser = (callback) => {
if (Session.isAnonymousUser()) {
InteractionManager.runAfterInteractions(() => {
Session.signOutAndRedirectToSignIn();
});
} else {
callback();
}
};
Then use that function in onDownloadButtonPress event:
Please re-state the problem that we are trying to solve in this issue.
The behavior of the download attachment function should be consistent between context menu and attachment preview, allow anonymous users to view the chat and attached file.
What is the root cause of that problem?
The difference here is because at BaseReportActionContextMenu we check anonymous and logout here.
changed the title [-]Web - Users can download attachments when viewing attachment previews as anonymous users[/-][+][HOLD - #21977] Web - Users can download attachments when viewing attachment previews as anonymous users[/+]on Jul 11, 2023
Thks @alexpensify, maybe this is eligible to compensation though:
We decided to fix this in #21977 since it was also related to the anonymous user logic but this error wasn't reported and wouldn't have been fixed without this issue.
Since this is similar to #22307 (that one is about the copy message button not working) which was also closed because of #21977 and since it was also reported by @tranvantoan-qn I'm not sure if both issues are eligible for compensation though.
IMO since both reported issues are pretty similar we can compensate them once but I may be wrong!
@PauloGasparSv, @alexpensify
I truly appreciate your consideration regarding the payment, even if there might be uncertainty about it.
As a bug reporter (who faced with many cases of bug rejection 😂), any payment would be of great help to support my efforts and motivation. I will be happy with any decision the team make. Your thoughtfulness means a lot to me, thank you!
After reviewing again, since there was a reporting bonus issued to @tranvantoan-qn here #22307. Toan reported this one too but these three GHs are related to anonymous user logic. In this case, we should issue only one reporting bonus and there should have been one OP. I appreciate your understanding!
Activity
melvin-bot commentedon Jul 11, 2023
Triggered auto assignment to @alexpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Jul 11, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)kbecciv commentedon Jul 11, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Users can download attachments when viewing attachment previews as anonymous users.
What is the root cause of that problem?
We always allow the user to download the attachment without checking whether or not the user is anonymous.
https://github.com/Expensify/App/blob/staging/src/components/AttachmentModal.js#L305
What changes do you think we should make in order to solve the problem?
Add a function to check whether or not the user is anonymous:
Then use that function in onDownloadButtonPress event:
What alternative solutions did you explore? (Optional)
N/A
namhihi237 commentedon Jul 11, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
The behavior of the download attachment function should be consistent between context menu and attachment preview, allow anonymous users to view the chat and attached file.
What is the root cause of that problem?
The difference here is because at
BaseReportActionContextMenuwe check anonymous and logout here.App/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.js
Lines 74 to 85 in 900b328
What changes do you think we should make in order to solve the problem?
Here we will add a key to determine whether to allow anonymous users or not:
isAllowAnonymous: trueIn the
interceptAnonymousUserwe should addisAllowAnonymousparam to check:What alternative solutions did you explore? (Optional)
N/A
PauloGasparSv commentedon Jul 11, 2023
Hey @alexpensify we are coming up with a fix for this in #21977 so I think we can put this on HOLD for #21977.
[-]Web - Users can download attachments when viewing attachment previews as anonymous users[/-][+][HOLD - #21977] Web - Users can download attachments when viewing attachment previews as anonymous users[/+]alexpensify commentedon Jul 11, 2023
Thank you @PauloGasparSv for that update! I've placed this one on hold.
alexpensify commentedon Jul 18, 2023
Looks like the other PR is being reviewed, still on hold here.
alexpensify commentedon Jul 25, 2023
@PauloGasparSv - I think this one is ready for another round of testing or should we close it because the other GH corrected it? Thank you!
alexpensify commentedon Aug 1, 2023
@PauloGasparSv - I think you are back online from vacation. Could you review if we are cleared to close this one? Thanks!
PauloGasparSv commentedon Aug 1, 2023
Sure thing @alexpensify, sorry for the delay here, I was stuck on some other reviews and issues : /
Checking this out right now!
PauloGasparSv commentedon Aug 1, 2023
Our fix worked!!! @alexpensify we are cleared to close this (not sure if who reported should be compensated first so not closing this myself)
Screen.Recording.2023-08-01.at.18.42.16.mov
alexpensify commentedon Aug 1, 2023
Thank you! All set, I'm going to close this one out. There is no payment here since it's related to a GH that was open before this one - #21977.
PauloGasparSv commentedon Aug 1, 2023
Thks @alexpensify, maybe this is eligible to compensation though:
We decided to fix this in #21977 since it was also related to the anonymous user logic but this error wasn't reported and wouldn't have been fixed without this issue.
Since this is similar to #22307 (that one is about the copy message button not working) which was also closed because of #21977 and since it was also reported by @tranvantoan-qn I'm not sure if both issues are eligible for compensation though.
IMO since both reported issues are pretty similar we can compensate them once but I may be wrong!
tranvantoan-qn commentedon Aug 2, 2023
@PauloGasparSv, @alexpensify
I truly appreciate your consideration regarding the payment, even if there might be uncertainty about it.
As a bug reporter (who faced with many cases of bug rejection 😂), any payment would be of great help to support my efforts and motivation. I will be happy with any decision the team make. Your thoughtfulness means a lot to me, thank you!
alexpensify commentedon Aug 2, 2023
After reviewing again, since there was a reporting bonus issued to @tranvantoan-qn here #22307. Toan reported this one too but these three GHs are related to anonymous user logic. In this case, we should issue only one reporting bonus and there should have been one OP. I appreciate your understanding!