feat: add EnableUI setting to gate webapp product registration#13
feat: add EnableUI setting to gate webapp product registration#13
Conversation
Add a new EnableUI plugin setting and a /config API endpoint so the webapp can check whether the Channel Automation UI should be shown. When disabled (the default), the plugin skips product registration entirely, keeping the product switcher clean.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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 Tip CodeRabbit can scan for known vulnerabilities in your dependencies using OSV Scanner.OSV Scanner will automatically detect and report security vulnerabilities in your project's dependencies. No additional configuration is required. |
There was a problem hiding this comment.
Pull request overview
This PR adds an EnableUI plugin setting that controls whether the Channel Automation product is registered in the Mattermost webapp product switcher. A new GET /api/v1/config endpoint exposes client-relevant configuration, and the webapp fetches it during initialization to conditionally skip product registration.
Changes:
- New
EnableUIboolean setting inplugin.jsonandconfigurationstruct (defaultfalse) - New
GET /api/v1/configendpoint returning client config, with authentication enforced by existing middleware - Webapp fetches config on init and skips product registration when
enable_uiis false
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
server/configuration.go |
Adds EnableUI field to the configuration struct |
server/api.go |
Adds /config route and handleGetClientConfig handler |
webapp/src/client.ts |
Adds ClientConfig type and getConfig() fetch function |
webapp/src/index.tsx |
Fetches config on init; skips product registration if UI disabled |
server/plugin_test.go |
Tests for auth, default value, and enabled value on config endpoint |
plugin.json |
Declares the EnableUI setting with help text |
docs/api.md |
Documents the new /config endpoint |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
EnableUIboolean plugin setting (default:false) to control whether the Channel Automation product appears in the webapp product switcherGET /api/v1/configendpoint that returns client-relevant configuration to the webappenable_uiisfalse, keeping the product switcher clean by defaultTest plan
EnableUIset tofalse(default), the Channel Automation product does not appear in the product switcherEnableUIset totrue, the product appears and functions normallyGET /api/v1/configreturns{"enable_ui": false}by default and{"enable_ui": true}when configured/api/v1/configreturn 401make testto confirm all new and existing tests pass