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
[$500] IOU - "Unsubscribe from thread" button is visible on the hover menu #34428
Version Number: 1.4.24.7 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 Expensify/Expensify Issue URL: Issue reported by: Applause internal team Slack conversation:
Action Performed:
Create a workspace
Create a scan IOU with a PDF in the workspace chat (make sure to keep hovering over the IOU on Windows)
Expected Result:
The button shouldn't disappear.
Actual Result:
"Unsubscribe from thread" button is visible for a short time on the hover menu.
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?
changed the title [-]IOU - "Unsubscribe from thread" button is visible on the hover menu[/-][+][$500] IOU - "Unsubscribe from thread" button is visible on the hover menu[/+]on Jan 12, 2024
In here because we don't set childReportNotificationPreference in reportAction of request money message, childReportNotificationPreference is empty string then we check isActionCreator
so subscribed is true and we display unsubcribe button on the context menu
What changes do you think we should make in order to solve the problem?
Note that: This bug only be happened at a moment because the API return childReportNotificationPreference: 'hidden' in reportAction of request money message
We should set childReportNotificationPreferenc === 'hidden' in optimistic data of request money message
Please re-state the problem that we are trying to solve in this issue.
The unsubscribe option menu shows for a brief moment on a scanning request.
What is the root cause of that problem?
One of the conditions the unsubs option will show is that the childReportNotificationPreference is not hidden. When we create a scan request, the childReportNotificationPreference is empty.
Because it's empty, based on the logic above, the value will default to ALWAYS because we are the creator. Then, later we will get a HIDDEN value from the server, so the button hides, but the subscribe option never shows because we hide it if it's a whisper.
What changes do you think we should make in order to solve the problem?
We can hide the unsubscribe option too if it's a whisper.
we can optionally set the notification preference to hidden optimistically ONLY when the request is going to be scanned by checking the length of the whisperedToAccountIDs in buildOptimisticIOUReportAction
Problem Statement:
The "Unsubscribe from thread" button is briefly visible on the hover menu, causing a momentary glitch.
Root Cause Analysis:
Upon reviewing the provided information, it appears that the issue lies within the handling of childReportNotificationPreference in the ContextMenuActions.js file. Specifically, when creating a scan request, childReportNotificationPreference is initially empty, and later, a value of 'hidden' is returned from the server. However, due to the logic in place, the value defaults to 'ALWAYS' before being updated to 'HIDDEN', causing the button to briefly appear.
Solution Approach:
To address this issue, I propose the following changes:
Explicitly Set childReportNotificationPreference:
In cases where the API returns childReportNotificationPreference: 'hidden' for a scan request, we should explicitly set this value in the ContextMenuActions.js file. This ensures that the correct notification preference is established upfront, preventing the momentary display of the "Unsubscribe from thread" button.
javascript
Copy code
// Add this line where appropriate based on the logic flow
childReportNotificationPreference = 'hidden';
Optional Setting for Whisper Cases:
Considering the nature of the whisper scenario, we can hide the "Unsubscribe from thread" button if it's a whisper. This adjustment ensures that the button is not visible when it shouldn't be, providing a more consistent user experience.
javascript
Copy code
// Update the existing condition to include the check for whisper
return subscribed && (isCommentAction || isReportPreviewAction || isIOUAction) && (!isDeletedAction || shouldDisplayThreadReplies) && !isWhisper;
Optimistic Setting for Scanned Requests:
Optionally, we can set the notification preference to 'hidden' optimistically when the request is going to be scanned. This can be achieved by checking the length of the whisperedToAccountIDs in the buildOptimisticIOUReportAction function.
javascript
Copy code
// Add this check in buildOptimisticIOUReportAction
if (whisperedToAccountIDs.length > 0) {
reportAction.childReportNotificationPreference = 'hidden';
}
Conclusion:
These proposed changes aim to resolve the issue of the momentary visibility of the "Unsubscribe from thread" button by ensuring proper handling of childReportNotificationPreference in relevant scenarios. I am committed to implementing these changes once officially onboarded and given access to the codebase.
I look forward to your feedback and the opportunity to contribute to enhancing the stability and usability of the Expensify system.
📣 @AliKhokhar123! 📣
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:
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.
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.
Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
@DylanDylann Thanks for the proposal. Your RCA is about right. However when the server response is received I expected the subscribe button to appear. The fact that it didn't means we have some other inconsistency to deal with (not a blocker). Setting the childReportNotificationPreference in the optimistic data is not a wrong approach but I don't think it's necessary, we don't seem to be setting this field anywhere so let's keep it that way for simplicity.
Activity
[-]IOU - "Unsubscribe from thread" button is visible on the hover menu[/-][+][$500] IOU - "Unsubscribe from thread" button is visible on the hover menu[/+]melvin-bot commentedon Jan 12, 2024
Triggered auto assignment to @puneetlath (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Jan 12, 2024
Job added to Upwork: https://www.upwork.com/jobs/~0117b089c8644a20b4
melvin-bot commentedon Jan 12, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @s77rt (
External)DylanDylann commentedon Jan 12, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
"Unsubscribe from thread" button is visible for a short time on the hover menu.
What is the root cause of that problem?
App/src/pages/home/report/ContextMenu/ContextMenuActions.js
Line 206 in b6a18b1
In here because we don't set
childReportNotificationPreferencein reportAction of request money message,childReportNotificationPreferenceis empty string then we checkisActionCreatorApp/src/pages/home/report/ContextMenu/ContextMenuActions.js
Lines 201 to 202 in b6a18b1
so
subscribedis true and we display unsubcribe button on the context menuWhat changes do you think we should make in order to solve the problem?
Note that: This bug only be happened at a moment because the API return
childReportNotificationPreference: 'hidden'in reportAction of request money messageWe should set childReportNotificationPreferenc === 'hidden' in optimistic data of request money message
App/src/libs/ReportUtils.ts
Line 2899 in b6a18b1
We should add
as the value is returned from BE
What alternative solutions did you explore? (Optional)
NA
bernhardoj commentedon Jan 12, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
The unsubscribe option menu shows for a brief moment on a scanning request.
What is the root cause of that problem?
One of the conditions the unsubs option will show is that the
childReportNotificationPreferenceis not hidden. When we create a scan request, thechildReportNotificationPreferenceis empty.App/src/pages/home/report/ContextMenu/ContextMenuActions.js
Lines 199 to 213 in b6a18b1
Because it's empty, based on the logic above, the value will default to ALWAYS because we are the creator. Then, later we will get a HIDDEN value from the server, so the button hides, but the subscribe option never shows because we hide it if it's a whisper.
App/src/pages/home/report/ContextMenu/ContextMenuActions.js
Lines 170 to 171 in b6a18b1
What changes do you think we should make in order to solve the problem?
We can hide the unsubscribe option too if it's a whisper.
we can optionally set the notification preference to hidden optimistically ONLY when the request is going to be scanned by checking the length of the
whisperedToAccountIDsinbuildOptimisticIOUReportActionAliKhokhar123 commentedon Jan 12, 2024
Contributor details
Your Expensify account email: alikhokhar01233210@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~015c32305f13acc7f8
Problem Statement:
The "Unsubscribe from thread" button is briefly visible on the hover menu, causing a momentary glitch.
Root Cause Analysis:
Upon reviewing the provided information, it appears that the issue lies within the handling of childReportNotificationPreference in the ContextMenuActions.js file. Specifically, when creating a scan request, childReportNotificationPreference is initially empty, and later, a value of 'hidden' is returned from the server. However, due to the logic in place, the value defaults to 'ALWAYS' before being updated to 'HIDDEN', causing the button to briefly appear.
Solution Approach:
To address this issue, I propose the following changes:
Explicitly Set childReportNotificationPreference:
In cases where the API returns childReportNotificationPreference: 'hidden' for a scan request, we should explicitly set this value in the ContextMenuActions.js file. This ensures that the correct notification preference is established upfront, preventing the momentary display of the "Unsubscribe from thread" button.
javascript
Copy code
// Add this line where appropriate based on the logic flow
childReportNotificationPreference = 'hidden';
Optional Setting for Whisper Cases:
Considering the nature of the whisper scenario, we can hide the "Unsubscribe from thread" button if it's a whisper. This adjustment ensures that the button is not visible when it shouldn't be, providing a more consistent user experience.
javascript
Copy code
// Update the existing condition to include the check for whisper
return subscribed && (isCommentAction || isReportPreviewAction || isIOUAction) && (!isDeletedAction || shouldDisplayThreadReplies) && !isWhisper;
Optimistic Setting for Scanned Requests:
Optionally, we can set the notification preference to 'hidden' optimistically when the request is going to be scanned. This can be achieved by checking the length of the whisperedToAccountIDs in the buildOptimisticIOUReportAction function.
javascript
Copy code
// Add this check in buildOptimisticIOUReportAction
if (whisperedToAccountIDs.length > 0) {
reportAction.childReportNotificationPreference = 'hidden';
}
Conclusion:
These proposed changes aim to resolve the issue of the momentary visibility of the "Unsubscribe from thread" button by ensuring proper handling of childReportNotificationPreference in relevant scenarios. I am committed to implementing these changes once officially onboarded and given access to the codebase.
I look forward to your feedback and the opportunity to contribute to enhancing the stability and usability of the Expensify system.
Best regards,
Ali Ahmed
melvin-bot commentedon Jan 12, 2024
📣 @AliKhokhar123! 📣
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:
Format:
s77rt commentedon Jan 13, 2024
@DylanDylann Thanks for the proposal. Your RCA is about right. However when the server response is received I expected the subscribe button to appear. The fact that it didn't means we have some other inconsistency to deal with (not a blocker). Setting the
childReportNotificationPreferencein the optimistic data is not a wrong approach but I don't think it's necessary, we don't seem to be setting this field anywhere so let's keep it that way for simplicity.26 remaining items
s77rt commentedon Feb 5, 2024
@puneetlath When you get a chance please check #34428 (comment)
Also cc @rlinoz as I think you worked on notification preferences
rlinoz commentedon Feb 6, 2024
I think we started returning
hiddenso it doesn't show up in the LHN, but I am not sure if this is the same thing.cc: @srikarparsi @marcaaron
s77rt commentedon Feb 7, 2024
Not overdue. ^
srikarparsi commentedon Feb 9, 2024
Hey, we actually removed the leave thread/unsubscribe from thread option everywhere so I don't think this issue will be there anymore?
melvin-bot commentedon Feb 9, 2024
@puneetlath @s77rt this issue is now 4 weeks old and preventing us from maintaining WAQ, can you:
Thanks!
melvin-bot commentedon Feb 9, 2024
Current assignee @s77rt is eligible for the Internal assigner, not assigning anyone new.
s77rt commentedon Feb 9, 2024
@srikarparsi Correct! This is no longer reproducible
puneetlath commentedon Feb 9, 2024
Ah cool, I'll go ahead and close this out then. Thanks y'all.