Skip to content

[Due for payment 2025-06-11] [$250] tags-User able to delete all tags. #62537

Closed

Description

@mitarachim

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 1.48-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: #58052
Email or phone of affected tester (no customers): slottwo1@gmail.com
Issue reported by: Applause Internal Team
Device used: Redminote 10s android 13 phone
App Component: Workspace Settings

Action Performed:

  1. Launch app
  2. Create a new workspace and enable tags
  3. Tap Tags
  4. Add a tag
  5. Tap settings - enable members must tag all expenses
  6. Delete the tag

Expected Result:

User must not be able to delete all tags. Cannot delete all tags modal must be shown.

Actual Result:

User able to delete all tags and Cannot delete all tags modal is not shown.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6838761_1747870155789.Screenrecorder-2025-05-22-04-55-18-872.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021927373792094838117
  • Upwork Job ID: 1927373792094838117
  • Last Price Increase: 2025-05-27
  • Automatic offers:
    • nkdengineer | Contributor | 107474659
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @mananjadhav

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 22, 2025
  2. melvin-bot commented on May 22, 2025

    @melvin-bot

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

  3. ijmalik commented on May 22, 2025

    @ijmalik
    Contributor

    Hi @sakluger

    The issue has been resolved in v9.1.49-4.

    62537.mp4
  4. mitarachim commented on May 22, 2025

    @mitarachim
    Author

    QA team still reproduce this issue using build v9.1.49-4

    Screenrecorder-2025-05-22-09-01-38-592.mp4
  5. nkdengineer commented on May 22, 2025

    @nkdengineer
    Contributor

    Proposal

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

    User able to delete all tags and Cannot delete all tags modal is not shown.

    What is the root cause of that problem?

    When we update requiresTag, we only update required in policy tags data if the the tags are multi-level tag

    if (isMultiLevelTags) {
    const getUpdatedTagsData = (required: boolean): OnyxUpdate => ({
    key: `${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`,
    onyxMethod: Onyx.METHOD.MERGE,
    value: {
    ...Object.keys(policyTags).reduce<PolicyTagLists>((acc, key) => {
    acc[key] = {
    ...acc[key],
    required,
    };
    return acc;
    }, {}),
    },
    });
    onyxData.optimisticData?.push(getUpdatedTagsData(requiresTag));
    onyxData.failureData?.push(getUpdatedTagsData(!requiresTag));
    onyxData.successData?.push(getUpdatedTagsData(requiresTag));
    }

    Then isDisablingOrDeletingLastEnabledTag returns false when we select all tags, it's only updated until the tag list is updated from the backend with required as true

    function isDisablingOrDeletingLastEnabledTag(policyTagList: PolicyTagList | undefined, selectedTags: Array<PolicyTag | undefined>): boolean {
    const enabledTagsCount = getCountOfEnabledTagsOfList(policyTagList?.tags);
    if (!enabledTagsCount) {
    return false;
    }
    if (policyTagList?.required && selectedTags.filter((selectedTag) => selectedTag?.enabled).length === enabledTagsCount) {
    return true;
    }

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

    We should also update required as true for normal tags. We can remove isMultiLevelTags check here since normal tags are also objects with tag names like multi-level tags.

    if (isMultiLevelTags) {
    const getUpdatedTagsData = (required: boolean): OnyxUpdate => ({
    key: `${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`,
    onyxMethod: Onyx.METHOD.MERGE,
    value: {
    ...Object.keys(policyTags).reduce<PolicyTagLists>((acc, key) => {
    acc[key] = {
    ...acc[key],
    required,
    };
    return acc;
    }, {}),
    },
    });
    onyxData.optimisticData?.push(getUpdatedTagsData(requiresTag));
    onyxData.failureData?.push(getUpdatedTagsData(!requiresTag));
    onyxData.successData?.push(getUpdatedTagsData(requiresTag));
    }

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    Update setPolicyRequiresTag test and verify that required is updated to true for normal tags.

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  6. melvin-bot commented on May 27, 2025

    @melvin-bot

    @sakluger Eep! 4 days overdue now. Issues have feelings too...

  7. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on May 27, 2025
  8. changed the title [-]tags-User able to delete all tags.[/-] [+][$250] tags-User able to delete all tags.[/+] on May 27, 2025
  9. melvin-bot commented on May 27, 2025

    @melvin-bot
  10. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on May 27, 2025
  11. removed
    ExternalAdded to denote the issue can be worked on by a contributor
    Help WantedApply this label when an issue is open to proposals by contributors
    on May 27, 2025
  12. 27 remaining items

  13. melvin-bot commented on Jun 4, 2025

    @melvin-bot

    @mananjadhav @sakluger @mananjadhav The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  14. sakluger commented on Jun 11, 2025

    @sakluger
    Contributor

    @mananjadhav please complete the BZ checklist 🙏

  15. sakluger commented on Jun 11, 2025

    @sakluger
    Contributor

    Summarizing payment on this issue:

    Contributor: @nkdengineer $250, paid via Upwork
    Contributor+: @mananjadhav $250, please request on Newdot

  16. mananjadhav commented on Jun 13, 2025

    @mananjadhav
    Collaborator

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] 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: b5b6e9c#r159909682

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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: NA

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    Test:

    1. Create a new WS
    2. Enable tag features
    3. Create some tags
    4. Tap settings - enable members must tag all expenses
    5. Select all tags > Delete tags
    6. Verify that Cannot delete all tags modal is shown.

    Do we agree 👍 or 👎

  17. mananjadhav commented on Jun 13, 2025

    @mananjadhav
    Collaborator

    @sakluger Apologies for the delay. Here's the checklist ^

  18. melvin-bot commented on Jun 16, 2025

    @melvin-bot

    @mananjadhav Whoops! This issue is 2 days overdue. Let's get this updated quick!

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions