Open lanitochka17 opened 3 weeks ago
Triggered auto assignment to @stephanieelliott (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.
@stephanieelliott FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
We think that this bug might be related to #wave-collect - Release 1
π£ @akshsekhr2702! π£ 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:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Edited by proposal-police: This proposal was edited at 2024-08-27 14:56:45 UTC.
Categories - Employee has the option to edit categories when all the categories are disabled
We are not checking if the user can update category when we display empty state section here https://github.com/Expensify/App/blob/0fd1de0f279fffba0129484801942c3bddb148da/src/pages/iou/request/step/IOURequestStepCategory.tsx#L170-L173
We can check if the user is admin before displaying the empty section https://github.com/Expensify/App/blob/0fd1de0f279fffba0129484801942c3bddb148da/src/pages/iou/request/step/IOURequestStepCategory.tsx#L114
const shouldShowEmptyState = !isLoading && !shouldShowCategory && isPolicyAdmin(policy);
and display not found page when it is not policy admin and no categories in the list https://github.com/Expensify/App/blob/0fd1de0f279fffba0129484801942c3bddb148da/src/pages/iou/request/step/IOURequestStepCategory.tsx#L103
const shouldShowNotFoundPage =
(isEditing && (isSplitBill ? !canEditSplitBill : !ReportActionsUtils.isMoneyRequestAction(reportAction) || !ReportUtils.canEditMoneyRequest(reportAction))) ||
(!isLoading && !shouldShowCategory && !isPolicyAdmin(policy));
Edited by proposal-police: This proposal was edited at 2024-08-27 15:01:22 UTC.
Category page turns to empty state page with Edit categories button for employee which leads to not here page
We always show the edit category button even the user is not an admin of the workspace
We can use isPolicyAdmin
function to check whether the user is an admin or not then use it to show the edit category button or we can add disabled
prop for this button with isPolicyAdmin
check.
PolicyUtils.isPolicyAdmin(policy) && (
// Edit category button
)
OPTIONAL: We can display another message like Ask the admin to edit the category
We should still show the empty state component
If we want to display not found page in this case, we can add the condition to show not found page if shouldShowEmptyState
is true
and the user isn't the admin of the WS
const shouldShowNotFoundPage = (isEditing && (isSplitBill ? !canEditSplitBill : !ReportActionsUtils.isMoneyRequestAction(reportAction) || !ReportUtils.canEditMoneyRequest(reportAction))) || (shouldShowEmptyState && !PolicyUtils.isPolicyAdmin(policy));
Categories - Employee has the option to edit categories when all the categories are disabled
The shouldShowNotFoundPage
variable isn't checking if the user is a admin or not.
https://github.com/Expensify/App/blob/6ca91cddfbb4bbcd0ca24c9f10549057b6fd7332/src/pages/iou/request/step/IOURequestStepCategory.tsx#L103
We can update the condition: https://github.com/Expensify/App/blob/6ca91cddfbb4bbcd0ca24c9f10549057b6fd7332/src/pages/iou/request/step/IOURequestStepCategory.tsx#L103
TO:
const shouldShowNotFoundPage =
(isEditing && (isSplitBill ? !canEditSplitBill : !ReportActionsUtils.isMoneyRequestAction(reportAction) || !ReportUtils.canEditMoneyRequest(reportAction))) ||
(PolicyUtils.isPolicyAdmin(policy) && !OptionsListUtils.hasEnabledOptions(Object.values(policyCategories ?? {})));
Updated proposal
Job added to Upwork: https://www.upwork.com/jobs/~01775966fb678bc1d8
Triggered auto assignment to Contributor-plus team member for initial proposal review - @DylanDylann (External
)
Yea I agree this is not working as expected, there is a delay in hiding the categories once they are disabled.
Thanks everyone, @FitseTLT and @Krishna2323 have the same idea of displaying the not found page. But I prefer to display an empty view as suggested by @nkdengineer. I think we can hide the "Edit category" or update the button text to something like "Got it",... (maybe this will need to be confirmed in the PR phase)
Let's go with @nkdengineer's proposal
π π π C+ reviewed
Triggered auto assignment to @carlosmiceli, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
π£ @DylanDylann π 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 π
@carlosmiceli I see the behavior on other pages is different. With the same step
Should we adjust all these pages to make it consistent
@DylanDylann that's a good point, we should (I think). Let me get back on this. I think for now we should proceed fixing the issue as originally proposed, and we'll create another issue for standardizing those pages if we want.
@DylanDylann I'm not being able to reproduce this for Tags for example, it continues to display the Tags until the user reloads the app. Could you show me a video of how you get to each empty screen for Tags and Reports? Thank you!
@carlosmiceli Sorry for my delay. I test in the same admin account and using two chrome tab
https://github.com/user-attachments/assets/290af9b7-2e30-42e2-8a15-a13767588a17
cc @nkdengineer Could you help to verify the output when login in the 2 account as in the OP with Tag and report field
This PR should be merged with today's deploy π
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: 9.0.25-1 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4895538 Email or phone of affected tester (no customers): applausetester+kh050806@applause.expensifail.com Issue reported by: Applause - Internal Team
Action Performed:
Precondition:
Expected Result:
Category page will turn to not here page for employee after admin disables all the categories
Actual Result:
Category page turns to empty state page with Edit categories button for employee which leads to not here page
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/user-attachments/assets/80e116b4-6e1a-496c-a5e0-00a326065905
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @DylanDylann