Diya 🔥 feat: Enhanced existing User State Feature#2148
Merged
one-community merged 3 commits intodevelopmentfrom Apr 7, 2026
Merged
Diya 🔥 feat: Enhanced existing User State Feature#2148one-community merged 3 commits intodevelopmentfrom
one-community merged 3 commits intodevelopmentfrom
Conversation
one-community
approved these changes
Apr 3, 2026
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Backend implementation for the enhanced User State Feature. Introduces the
emojifield to theUserStateCatalogmodel, expands the catalog management API with emoji/color support, adds a batch selections endpoint for efficient team list loading, and includes password-protected utility scripts for catalog and selection management.Related PRS (if any):
This backend PR is related to the frontend PR #5098
Main changes explained:
src/models/userStateCatalog.js— addemojifield (String, default''), updatecolordefault from'blue'to'#3498db'src/controllers/userStateController.js— accept and sanitizeemojiincreateCatalogandupdateCatalog; updateALLOWED_COLORSto hex values (15 colors); addgenerateKeywith random suffix replacing slugify-based key generation to prevent emoji collision; add duplicate detection (samelabel+emojiblocked with 409); fixupdateCataloglabel clash check to allow case-only edits; fixisActivelogic to only cascade-delete user selections when explicitly set tofalse; addgetBatchUserSelectionsfor single-call team selections fetch (supports up to 3000 userIds); addgetCatalogItemUsageto count users assigned a given state before deletionsrc/routes/userState.js— registerPOST /selections/batchandGET /catalog/:key/usageroutessrc/scripts/seedUserCatalog.js— idempotent seed script for 5 default states with emoji, label, color, and order; skips existing keys with log outputsrc/scripts/resetUserCatalog.js— password-protected (RESET_USERCATALOG_PASSWORDenv var) catalog reset script with double confirmation promptsrc/scripts/resetUserStateSelections.js— password-protected (RESET_USERSELECTIONS_PASSWORDenv var) selections reset script with double confirmation prompt.gitignore— removescripts/ignore rule so utility scripts are trackedHow to test:
Follow testing instructions on the frontend PR #5098
Note:
RESET_USERCATALOG_PASSWORD,RESET_USERSELECTIONS_PASSWORD) — add these to your.envbefore running. Reach out to author of this PR for passwordsnode src/scripts/seedUserCatalog.jsonce on each environment (dev/prod) to populate the default catalog states — script is safe to re-run (skips existing keys)