Skip to content

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

Description

@carlosmiceli

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:

  • Logged into NewDot as the admin of a workspace in one window and a member in another.
  • Go to workspace settings as admin.
  • Go to the tags section
  • Make sure there are tags on the workspaces
  • As a member, open a report's tags in that workspace.
  • As an admin, delete all of the tags.

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?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

tags.error.mov

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

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Sep 9, 2024
  2. self-assigned this
    on Sep 9, 2024
  3. melvin-bot commented on Sep 9, 2024

    @melvin-bot

    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.

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Sep 9, 2024
  5. changed the title [-]RHN throws error if tags are deleted by admin while member is selecting.[/-] [+][$250] RHN throws error if tags are deleted by admin while member is selecting.[/+] on Sep 9, 2024
  6. melvin-bot commented on Sep 9, 2024

    @melvin-bot
  7. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Sep 9, 2024
  8. melvin-bot commented on Sep 9, 2024

    @melvin-bot

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

  9. FitseTLT commented on Sep 9, 2024

    @FitseTLT
    Contributor

    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

    const shouldShowTag = ReportUtils.isReportInGroupPolicy(report) && (transactionTag || OptionsListUtils.hasEnabledTags(policyTagLists));

    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
      {shouldShowEmptyState && (
      <View style={[styles.flex1]}>
      <WorkspaceEmptyStateSection
      shouldStyleAsCard={false}

      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

    1. We should also set up edit tag button equivalent to edit category button (with the respective copy text and route to navigate to) here

      {PolicyUtils.isPolicyAdmin(policy) && (
      <FixedFooter style={[styles.mtAuto, styles.pt5]}>
      <Button
      large
      success
      style={[styles.w100]}
      onPress={() =>
      Navigation.navigate(
      ROUTES.SETTINGS_CATEGORIES_ROOT.getRoute(
      policy?.id ?? '-1',
      ROUTES.MONEY_REQUEST_STEP_CATEGORY.getRoute(action, iouType, transactionID, report?.reportID ?? '-1', backTo, reportActionID),
      ),
      )
      }
      text={translate('workspace.categories.editCategories')}
      pressOnEnter
      />
      </FixedFooter>

      The button will appear if the user is an admin

    2. 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 )

    3. 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 )

    4. 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)

  10. cretadn22 commented on Sep 10, 2024

    @cretadn22
    Contributor

    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

    {shouldShowEmptyState && (
    <View style={[styles.flex1]}>
    <WorkspaceEmptyStateSection
    shouldStyleAsCard={false}
    icon={Illustrations.EmptyStateExpenses}
    title={translate('workspace.categories.emptyCategories.title')}
    subtitle={translate('workspace.categories.emptyCategories.subtitle')}
    containerStyle={[styles.flex1, styles.justifyContentCenter]}
    />
    {PolicyUtils.isPolicyAdmin(policy) && (
    <FixedFooter style={[styles.mtAuto, styles.pt5]}>
    <Button
    large
    success
    style={[styles.w100]}
    onPress={() =>
    Navigation.navigate(
    ROUTES.SETTINGS_CATEGORIES_ROOT.getRoute(
    policy?.id ?? '-1',
    ROUTES.MONEY_REQUEST_STEP_CATEGORY.getRoute(action, iouType, transactionID, report?.reportID ?? '-1', backTo, reportActionID),
    ),
    )
    }
    text={translate('workspace.categories.editCategories')}
    pressOnEnter
    />
    </FixedFooter>
    )}
    </View>

    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)

  11. FitseTLT commented on Sep 10, 2024

    @FitseTLT
    Contributor

    Sorry forgot to notify Updated

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

  12. parasharrajat commented on Sep 10, 2024

    @parasharrajat
    Member

    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?

  13. 14 remaining items

  14. carlosmiceli commented on Sep 18, 2024

    @carlosmiceli
    ContributorAuthor

    @FitseTLT That's correct!

  15. abekkala commented on Oct 11, 2024

    @abekkala
    Contributor

    PAYMENT SUMMARY OCT 11

    Fix: @FitseTLT [$250] OFFER
    PR Review: @parasharrajat [$250] payment via NewDot

  16. abekkala commented on Oct 11, 2024

    @abekkala
    Contributor

    @FitseTLT payment sent and contract ended - thank you! 🎉

  17. abekkala commented on Oct 11, 2024

    @abekkala
    Contributor

    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:

    • [@parasharrajat] The PR that introduced the bug has been identified. Link to the PR:
    • [@parasharrajat] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
    • [@parasharrajat] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
    • [@parasharrajat] Determine if we should create a regression test for this bug.
    • [@parasharrajat] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
    • [@abekkala] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  18. parasharrajat commented on Oct 13, 2024

    @parasharrajat
    Member

    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:

    • [@parasharrajat] The PR that introduced the bug has been identified. Link to the PR: New feature
    • [@parasharrajat] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: New Feature
    • [@parasharrajat] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: Not needed
    • [@parasharrajat] Determine if we should create a regression test for this bug. Yes
    • [@parasharrajat] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

    Regression Test Steps

    1. Log into NewDot as the admin of a workspace in two devices
    2. Go to workspace settings as admin on Device A
    3. Go to the tags section
    4. Make sure there are tags on the workspaces
    5. On Device B, start creating an expense and on confirmation page press on tag to open tag picker
    6. On Device A, delete or disable all of the tags.
    7. On Device B Verify that you haven't created any tags message with Edit tags button appear
    8. Press on the button and create or enable some tags you have disabled and navigate back to the tag picker
    9. select any tag and submit the expense
    10. Verify that the tag you selected appears in the created expense

    Do you agree 👍 or 👎 ?

  19. abekkala commented on Oct 14, 2024

    @abekkala
    Contributor

    PAYMENT SUMMARY

  20. parasharrajat commented on Dec 12, 2024

    @parasharrajat
    Member

    Payment requested as per #48822 (comment)

  21. JmillsExpensify commented on Dec 16, 2024

    @JmillsExpensify
    Contributor

    $250 approved for @parasharrajat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions