Skip to content

feat: add EnableUI setting to gate webapp product registration#13

Open
fmartingr wants to merge 1 commit intomainfrom
opencode/quiet-rocket
Open

feat: add EnableUI setting to gate webapp product registration#13
fmartingr wants to merge 1 commit intomainfrom
opencode/quiet-rocket

Conversation

@fmartingr
Copy link
Collaborator

@fmartingr fmartingr commented Mar 16, 2026

Summary

  • Adds a new EnableUI boolean plugin setting (default: false) to control whether the Channel Automation product appears in the webapp product switcher
  • Adds a GET /api/v1/config endpoint that returns client-relevant configuration to the webapp
  • Webapp now fetches the config on initialization and skips product registration when enable_ui is false, keeping the product switcher clean by default

Test plan

  • Verify that with EnableUI set to false (default), the Channel Automation product does not appear in the product switcher
  • Verify that with EnableUI set to true, the product appears and functions normally
  • Verify GET /api/v1/config returns {"enable_ui": false} by default and {"enable_ui": true} when configured
  • Verify unauthenticated requests to /api/v1/config return 401
  • Run make test to confirm all new and existing tests pass

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.
@coderabbitai
Copy link

coderabbitai bot commented Mar 16, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: b6818025-f0ec-4acd-9c9f-47d93f2f938a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch opencode/quiet-rocket
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 EnableUI boolean setting in plugin.json and configuration struct (default false)
  • New GET /api/v1/config endpoint returning client config, with authentication enforced by existing middleware
  • Webapp fetches config on init and skips product registration when enable_ui is 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants