Repository navigation
feat(web): let admins allow rule rows on profiles from Home rows - #1898
Conversation
The server setting that lets profiles build their own rule rows had no control in the web app. More on admin Home rows now has a "Let profiles add rule rows" switch. It reads the setting each time More opens and writes with If-Match. A change made elsewhere in the meantime shows the current value instead of overwriting it. Turning the setting off asks first, because profiles that already have rule rows can't change that page until they delete them. The rule builder on the admin page now says where this switch is. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The switch item skipped the menu item's muted icon color, so its icon stood out from the other menu items. The rule-row note sat under the rule builder as plain text; the mockup puts it last in the form as a filled note. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ing late Neither the read on a later open nor the cancel that keeps an older read from overwriting a just-saved value had a test that failed without it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 102aeb57ab
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let next = null as string | null; | ||
| const body = await v2("PUT /api/v2/admin/settings/sections", { | ||
| headers: { "If-Match": ifMatch }, | ||
| body: { allow_profile_custom_sections: allowProfileRuleRows }, |
There was a problem hiding this comment.
Avoid granting every admin-only recipe from a rule-row switch
Enabling this switch writes the broad allow_profile_custom_sections flag, not a rule-row-specific permission. HomeScreenSettings passes that flag to filterRecipeCatalog, which admits every recipe where admin_only is true, and internal/sections/recipes/admin_curated_list.go also marks admin_curated_list as admin-only. An admin using a control described solely as “Let profiles add rule rows” therefore also lets non-admin profiles create Editor's Picks rows, while disabling it can lock pages containing those rows. Either introduce a recipe-specific permission or make the control and confirmation describe the full scope of this flag.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed: the server flag admits every admin-only recipe, so it also covers admin_curated_list (Editor's picks) in Settings > Home Screen and in the save gate. A recipe-specific permission would be a server and contract change outside this web PR, so 53b6033 makes the control describe the full scope instead: the help line now reads "Profiles can build their own “Titles matching rules” and “Editor's picks” rows." and the turn-off confirm says profiles with rule rows or Editor's picks rows keep them but can't change that page until they delete them. The switch tests assert both strings.
…nto feat/home-rows-profile-rule-switch # Conflicts: # web/src/pages/AdminHomeRows.tsx
The server setting behind "Let profiles add rule rows" admits every admin-only row kind, so turning it on also lets profiles add Editor's picks rows in Settings > Home Screen, and turning it off locks pages holding them. The switch's help line and the turn-off confirm now name both kinds. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
The validation-task line should include Suggested line: Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
Problem
Related issue: #1137, #989, #1118
Validation tasks: none (no case covers whether profiles can add rule rows)
Stacked on #1897 (library copies), so this targets
feat/home-rows-library-copies. #1897 sits on #1895, #1893, #1891, #1889, #1885, #1884, #1883 and #1882. It retargets tofeat/collections-revamponce those merge.The server setting
sections.allow_profile_custom_sectionsdecides whether non-admin profiles can add their own rule rows ("Titles matching rules") in Settings > Home Screen. The web has no control for it, so an admin who wants to turn it on has to callPUT /api/v2/admin/settings/sectionsby hand. This PR adds the switch the approved Home rows design draws: "Let profiles add rule rows" under More on admin Home rows.Approach
menuitemcheckboxwitharia-checked, drawn with a switch in place of the check mark. The setting is server-wide, so the switch shows the same value on every page.PUT /api/v2/admin/settings/sectionswithIf-Matchset to the ETag that was read, never*. While the change saves, the switch shows the new value and is disabled. Any read still in flight is cancelled first, so an older answer can't replace the saved value. On success a toast confirms the change, and the page invalidates the["profile-section-flags"]query that Settings > Home Screen reads.profileRuleRowsSwitchcapability, which only the admin adapter sets; no component checks the account role.Differences from the plan and the approved design, for sign-off:
CheckboxItemprimitive, not theDropdownMenuCheckboxItemwrapper, because the wrapper always draws a check mark next to the switch. The role andaria-checkedare the same.Validation
make test-web(786 files, 7227 tests passed),pnpm run lint(0 errors; nothing reported in changed files),format:check,build,tsc -bandbudget:checkpass.If-Matchheader, a read on each open, the keyboard path (open More, reach the switch, toggle it, Escape, focus back on More), the switch disabled while saving, the confirm and its Cancel, the 412 and demo-mode 403 paths, an older read landing after a save, the profile flags query being invalidated, and the note appearing only with the capability and at the end of the form. The new tests fail against the base branch's code.make verify-local-pathspasses.Risks
Turning the setting off is now one click. The server then refuses every save on a non-admin profile's page that still holds one of its own rule rows or Editor's picks rows, until the profile deletes those rows. That was already true when the setting changed through the API. The confirm says so, and a later PR in this series adds a note and a "Delete rule rows…" action on the profile side. Until then, such a save fails with "Failed to save section changes" and the server's reason.
Other browsers that already read the profile flags keep them for up to five minutes, so Settings > Home Screen there can briefly offer or hide rule rows on the old value. The server checks every save either way.
No API,
section_type, recipe ID, preset key, layout export/import or hero change. The setting and its API already existed, so silo-apple, silo-android and jellycompat need no change.The user manual doesn't describe this setting. A siloserver.org issue covering it, along with the rest of the Home rows changes, is drafted and not filed yet.
Checklist
AI Disclosure
🤖 Generated with Claude Code
Note
Add admin More-menu switch on Admin Home to allow profile rule rows
PageMoreMenuEntrytypes are reworked — actions and switches are now discriminated shapes, and deferred-action bookkeeping replaces selected-item tracking in PageMoreMenu.tsx; existing menu consumers using action entries keep prior behaviorMacroscope summarized 53b6033.