-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Workspace - Category and Tag "Required" switch is enabled and locked evenif all tags are disable #55431
Comments
Triggered auto assignment to @alexpensify ( |
Template proposal ProposalPlease re-state the problem that we are trying to solve in this issue.Workspace - Category and Tag "Required" switch is enabled and locked evenif all tags are disable What is the root cause of that problem?we define the toggle logic active
in case we have turned it on before, the toggle will still be on and locked even though all categories are disabled What changes do you think we should make in order to solve the problem?We should turn off the active state of that toggle by update logic to isActive={(policy?.requiresCategory && hasEnabledOptions) ?? false} and do the same with the Tag page What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?NA What alternative solutions did you explore? (Optional)Or we can add new
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. |
The second |
But if the user enables some categories again, the toggle should turn on. If the backend sets requiresCategory to false after all categories are disabled, then after enabling some categories, the toggle will stay off. |
@alexpensify this is a |
@alexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick! |
I'm adding |
Update: Hot Pick |
@alexpensify this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks! |
Hot Pick! |
Weird, I thought this one was associated with a Project but updated it for more visibility. |
Weekly Update: Hot Pick |
Weekly Update: Hot Pick! |
I will start looking into this. I'm going to start by just looking into categories as I feel that whatever I find there will also apply to tags, but best to look at the separately to start with. @luacmartins You might know about this more than others. Investigation
ConclusionWhile the front end added this logic, there doesn't appear to be any matching backend logic, so the SolutionWe have a few options:
Since |
It seems like we already had this issue before (or a similar one) and we landed on this. It seems like we need some backend logic to enforce this. |
OK, thanks. That validates the BE logic needing to be added. I'll go ahead and write up a PR for it. I think I might scope it just to NewDot commands though. Both OldDot and NewDot share the same command logic, and I'm not in the mood to change how OldDot works for this one. |
I'm running into a problem with this... and even the frontend functionality is flawed I think. Let me illustrate the problem:
That works totally fine. Now, here is the part that doesn't work (the only step that changes is step 1)
Step 5 is wrong in this case because the workspace owner never wanted to require tags in the first place. Unfortunately, there is no way to prevent this from happening and the current logic cannot be fixed because there is no way for Step 5 to know what the workspace owner wanted in Step 1. I believe the true solution for this is that Any other desired functionality based on all the tags/categories being disabled or not should strictly relate to the tags/categories being enabled/disabled. tagging @trjExpensify on this one to see if you have any suggestions. |
Initially, in the update how we display / report expenses doc, the logic was introduced to force So in that case, you shouldn't be able to disable
Yeah, I also think this is a fine approach to clean this up, because there's nothing preventing a user from submitting an expense with a requiredCategory/tag coding field -- it'll get flagged as a violation (preventing the export attempt), and if the categories list is empty, they can ask their admin why they disabled all of the values. 😅
Agree for requiredTag. For requiredCategories though, it should be enabled when connecting to an accounting solution. It can remain enabled when accounting is disconnected, but just noting the desire to have |
Thanks, Tom. I don't see any problem with having SolutionIt sounds like the best path forward for this right now is:
There is a possible complimentary solution:
No backend changes would be required for any of these solutions and none of this would changes what happens to @trjExpensify Would you be OK with all three of these items? |
Sounds great to me! |
ProposalPlease re-state the problem that we are trying to solve in this issue.Category and Tag "Required" switch is enabled and locked evenif all tags are disable What is the root cause of that problem?The RCA is that the FE and BE logic doesn't match, the details are pointed out by @tgolen here. What changes do you think we should make in order to solve the problem?According to the expected solution from here:
App/src/libs/actions/Policy/Category.ts Line 882 in fe3d37c
And also remove the optimistic and success / failure data here: App/src/libs/actions/Policy/Category.ts Lines 918 to 920 in fe3d37c
App/src/libs/actions/Policy/Category.ts Lines 279 to 280 in fe3d37c
And also remove the optimistic and success / failure data here: App/src/libs/actions/Policy/Tag.ts Line 272 in fe3d37c
App/src/libs/actions/Policy/Tag.ts Line 284 in fe3d37c
App/src/libs/actions/Policy/Tag.ts Line 311 in fe3d37c
For this, we would require inputs from the design team for the exact mock, but we need to update the
Here For example in Categories Page, we will check: if Same would be done for tags. What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?We probably need to update some existing unit tests and also add new ones to check the new state of onyx data, we would check the state where we disable all category /tags and check on the UI if the warning modal is present What alternative solutions did you explore? (Optional)N/A |
@Expensify/design Could you help us come up with a mockup for this page? I would like it to display a warning at the top of it for when all categories are disabled. The message would say something like:
We would also do the same for the tags page. |
@tgolen is it possible to prevent the user from deselecting all of the categories if categorization is required? I'm just trying to think what the UI looks like to the user who is creating an expense in this case... would they be able to go edit the Category push row but then just see a blank list? I feel like we should try to prevent that? |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.87-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause - Internal Team
Component: Workspace Settings
Action Performed:
Expected Result:
The toggle is disabled and locked when all tags and categories are disabled
Actual Result:
The toggle is enabled and locked when all tags and categories are disabled
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6717031_1737140837036.bandicam_2025-01-17_21-46-17-653.mp4
View all open jobs on GitHub
The text was updated successfully, but these errors were encountered: