Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.34k stars 2.77k forks source link

[$250] RHN throws error if tags are deleted by admin while member is selecting. #48822

Open carlosmiceli opened 1 week ago

carlosmiceli commented 1 week ago

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:v9.0.30-19 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:Carlos Miceli Slack conversation:

Action Performed:

Expected Result:

There should be an "there are no tags yet" message.

Actual Result:

Workspace member sees an error view in the RHN instead.

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/444e3dcc-b6e1-4c9e-b68a-1178abdf3217

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021833231500737320464
  • Upwork Job ID: 1833231500737320464
  • Last Price Increase: 2024-09-16
  • Automatic offers:
    • FitseTLT | Contributor | 103987322
Issue OwnerCurrent Issue Owner: @parasharrajat
melvin-bot[bot] commented 1 week ago

Triggered auto assignment to @abekkala (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.

melvin-bot[bot] commented 1 week ago

Job added to Upwork: https://www.upwork.com/jobs/~021833231500737320464

melvin-bot[bot] commented 1 week ago

Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat (External)

FitseTLT commented 1 week ago

Edited by proposal-police: This proposal was edited at 2024-09-09 19:59:01 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

RHN throws error if tags are deleted by admin while member is selecting.

What is the root cause of that problem?

We show not found page when there are non enabled options here https://github.com/Expensify/App/blob/1b479b0602158fea8eb427fb215a14a18926c58f/src/pages/iou/request/step/IOURequestStepTag.tsx#L80-L81

What changes do you think we should make in order to solve the problem?

  1. We should implement empty state component as we did for category step page here https://github.com/Expensify/App/blob/1b479b0602158fea8eb427fb215a14a18926c58f/src/pages/iou/request/step/IOURequestStepCategory.tsx#L171-L174 and display the empty section when shouldShowTag is false but we should remove !shouldShowTag condition from shouldShowNotFoundPage

    const isLoading = !isOffline && policyTags === undefined;
    const shouldShowEmptyState = !isLoading && !shouldShowTag;

    (We might display not found page for non isReportInGroupPolicy instead of empty section as it might make more sense, we can apply the same change in category page too) and display tag picker only when !shouldShowEmptyState && !isLoading and show loading indicator when isLoading We should also use a new emptyTag title and subtitle copy

  2. We should also set up edit tag button equivalent to edit category button (with the respective copy text and route to navigate to) here https://github.com/Expensify/App/blob/1b479b0602158fea8eb427fb215a14a18926c58f/src/pages/iou/request/step/IOURequestStepCategory.tsx#L180-L197 The button will appear if the user is an admin

  3. To allow the user to easily create tags and navigate back to money request flow, we can create a similar page to SETTINGS_CATEGORIES_ROOT with the WorkspaceTagsPage component (as we did for category by linking the same WorkspaceCategoriesPage in MoneyRequestModalStackNavigator here )

  4. We will add tag root screen to SCREENS.RIGHT_MODAL.MONEY_REQUEST and link it to a route like settings/:policyID/tags and add the screen in MoneyRequestModalStackNavigator (WorkspaceTagsPage)

  5. We will pass MONEY_REQUEST_STEP_TAG route to backTo to allow the user to come back to the money request tag edit flow ROUTES.MONEY_REQUEST_STEP_TAG

What alternative solutions did you explore? (Optional)

cretadn22 commented 1 week ago

I provided a simple and correct proposal

Proposal

Please re-state the problem that we are trying to solve in this issue.

RHN throws error if tags are deleted by admin while member is selecting

What is the root cause of that problem?

We haven't added Empty View to IOURequestStepTag

What changes do you think we should make in order to solve the problem?

Idea: We should show the empty view with the Edit button exclusively for admins, following the same approach we used for the category page https://github.com/Expensify/App/blob/968b610b1cb3f46349ff50587d4a13948d1453b9/src/pages/iou/request/step/IOURequestStepCategory.tsx#L171-L199

Note: In IOURequestStepTag, the isLoading variable is unnecessary because we don't fetchData as we do in IOURequestStepCategory

Step to Implement:

  1. Eliminate the shouldShowTag condition from the shouldShowNotFoundPage
  2. Incorporate the following code into IOURequestStepTagStep
    
             {!shouldShowTag && (
                <View style={[styles.flex1]}>
                    <WorkspaceEmptyStateSection
                        ......
                    />
                    {PolicyUtils.isPolicyAdmin(policy) && (
                        <FixedFooter style={[styles.mtAuto, styles.pt5]}>
                           .....
                        </FixedFooter>
                    )}
                </View>
            )}
            {shouldShowTag && (
                Current Code
            )}


### What alternative solutions did you explore? (Optional)
FitseTLT commented 1 week ago

Sorry forgot to notify Updated

But note that my last update is hours before the other proposal above

parasharrajat commented 1 week ago

Ok. thanks everyone for the proposal and suggestions. I am inclined to implement a similar page like category selection.

@FitseTLT Looks like you are suggesting a couple more changes and some of them are enhancements.

Could you please structure your proposal in parts and clean it a bit?

cretadn22 commented 1 week ago

@parasharrajat How about my proposal?

FitseTLT commented 1 week ago

Ok. thanks everyone for the proposal and suggestions. I am inclined to implement a similar page like category selection.

@FitseTLT Looks like you are suggesting a couple more changes and some of them are enhancements.

Could you please structure your proposal in parts and clean it a bit?

@parasharrajat I have organized my proposal as per your request πŸ‘

parasharrajat commented 1 week ago

@cretadn22 I will review that in sometime.

parasharrajat commented 1 week ago

@FitseTLT's proposal looks good to me. @cretadn22 I don't see any differences in the approach. Your proposal looks identical to @FitseTLT.

:ribbon: :eyes: :ribbon: C+ reviewed

melvin-bot[bot] commented 1 week ago

Current assignee @carlosmiceli is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

melvin-bot[bot] commented 1 day ago

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] commented 1 day ago

πŸ“£ @FitseTLT πŸŽ‰ 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 commented 1 day ago

Sorry to miss this, assigned to @FitseTLT !