Repository navigation
fix(content): show a member the webhook settings read-only, so Test and Save aren't pressed only to be refused - #1673
Merged
Conversation
…nd Save aren't pressed only to be refused Follow-up from ansvisor#1605 (item 2). Only admins and managers can save a brand's webhook (webhook_configs' RLS) and test it (the API's assertWebhookEditor). A member saw Test Webhook and Save Webhook as for anyone and learned they couldn't only after pressing: a "forbidden" test result, or a failed save. The dialog now reads the role (useUserRole): for a member the address, secret, events and on/off switch show as they are but disabled, Test and Save are disabled, and a line says "Only admins and managers can change or test this webhook." The webhooks docs say members see it read-only. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…her disabled fields Review follow-up. The hand-made Active switch had no disabled styles, so a member saw it in full colour with the pointer cursor although it does nothing. It now takes disabled:cursor-not-allowed disabled:opacity-50, as the disabled checkboxes beside it do. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
Merged
9 of 12 tasks
gkhngyk
approved these changes
Oct 28, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good.
What I checked:
- Merge. Two commits (41705de, 2d1658b) on 3f6a4d4. It merges clean on main (b591947), alone and together with #1668 and #1672. #1668 changes the Delivery line two lines above this PR's docs line, and the two merge without a conflict.
- Role.
useUserRole().canManageis admin or manager. That matches the API'sWEBHOOK_ROLESand thewebhook_configswrite policies. The role comes fromRoleProviderin the dashboard layout, which is server-rendered, so the form doesn't show as editable first. With no provider, the context falls back toanalyst, so the form is read-only. - Dialog.
- For a member, the address, secret, event checkboxes and Active switch are disabled, and so are Test and Save.
- Close still works.
- The note shows above the form.
- The switch's
disabled:styles match the checkboxes. - Nothing changes for admins and managers.
- Tests.
- At the head,
_webhook-settings.test.tsxpasses (8). - With main's
_webhook-settings.tsxunder the head's test, the new member test fails. - CI passes.
- At the head,
- Before the API deploy. This is web only and doesn't depend on the API.
- Speed. No regex and no loop.
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.
Summary
Follow-up from #1605 (item 2): a member sees the webhook settings read-only, so they don't press Test or Save only to be refused.
Only admins and managers can save a brand's webhook (
webhook_configsRLS) and test it (the API'sassertWebhookEditor). A member saw Test Webhook and Save Webhook like anyone else, and only found out after pressing: a "forbidden" test result, or a failed save.useUserRole; it comes from the server layout, so the form doesn't flash editable first).disabled:styles, like the checkboxes beside it.Checked in the browser (local, 1024 px; demo user set to
analystfor the check, then back toadmin): the note shows, and every field and button except Close is disabled.Related issue
Follow-up from #1605's review.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
cd web && npx vitest run "src/app/[locale]/(dashboard)/dashboard/content/_webhook-settings.test.tsx"Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Full checks were run in one tree with this batch's ten follow-up branches merged, and again after the review fixes:
npm test: 246 files, 3,343 tests passed;vitest: 447 files, 4,352 tests passed (after the review fixes).A pre-push review was run on all ten branches.
🤖 Generated with Claude Code