Skip to content

Simplify settings option props - #1654

Open
skyfallwastaken wants to merge 1 commit into
mainfrom
amp/simplify-settings-option-props-20260901-022456
Open

skyfallwastaken wants to merge 1 commit into
mainfrom
amp/simplify-settings-option-props-20260901-022456

Conversation

@skyfallwastaken

Copy link
Copy Markdown
Member

Summary of the problem

Settings option props are assembled through a generic registry even though each option set has one page owner. This obscures ownership and leaves an unused default-all path.

Describe your changes

Remove the option registry and have Profile, Appearance and Editors build their own explicit option props. Keep the cached timezone calculation in the shared settings base and preserve legacy timezone pinning. Add focused controller coverage for the payload contracts.

Screenshots / Media

Not applicable. There are no visual changes.

Copilot AI lite review requested due to automatic review settings September 1, 2026 02:33
@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR removes the shared settings-option registry and moves each option payload to its sole owning controller while retaining the cached timezone list and legacy timezone pinning.

  • Appearance now supplies theme options directly from User.theme_options.
  • Editors now constructs extension text-type options locally.
  • Profile now constructs country and timezone options locally.
  • Focused controller tests verify the resulting Inertia payload contracts.

Confidence Score: 5/5

The PR appears safe to merge with no actionable regressions identified.

The inline builders preserve the removed registry’s option shapes and ordering, no callers remain for the removed API, and legacy timezone pinning continues without mutating the shared cached options.

Important Files Changed

Filename Overview
app/controllers/settings/base_controller.rb Removes the unused option registry while retaining the shared, memoized timezone calculation.
app/controllers/settings/appearance_controller.rb Replaces the registry lookup with the behaviorally equivalent theme-option source.
app/controllers/settings/editors_controller.rb Builds the same extension text-type payload directly in its owning controller.
app/controllers/settings/profile_controller.rb Builds country and timezone options directly while preserving legacy timezone pinning without mutating cached data.
test/controllers/settings_appearance_controller_test.rb Adds coverage for the Appearance page’s theme-option payload contract.
test/controllers/settings_editors_controller_test.rb Adds coverage for the Editors page’s extension text-type payload contract.
test/controllers/settings_profile_controller_test.rb Adds coverage for country ordering and legacy timezone pinning.

Reviews (1): Last reviewed commit: "Simplify settings option props" | Re-trigger Greptile

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 removes the generic settings option registry and moves responsibility for building settings “options” props into each owning settings controller (Profile, Appearance, Editors). It keeps the shared cached timezone options in Settings::BaseController and preserves legacy timezone pinning in the Profile settings page, with added controller tests to lock down the new payload contracts.

Changes:

  • Removed the shared options registry (BASE_OPTION_BUILDERS / base_options) and made each settings controller build its own explicit options payload.
  • Kept cached timezone option generation in Settings::BaseController and preserved legacy timezone pinning via ProfileController#pin_current_timezone.
  • Added focused integration tests asserting Inertia component selection and options payload structure for Profile, Appearance and Editors pages.

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
app/controllers/settings/base_controller.rb Removes the generic options registry while keeping the shared cached timezone options method.
app/controllers/settings/profile_controller.rb Builds explicit countries/timezones props and continues pinning legacy timezones.
app/controllers/settings/appearance_controller.rb Builds explicit themes options instead of using the removed registry.
app/controllers/settings/editors_controller.rb Builds explicit extension_text_types options instead of using the removed registry.
test/controllers/settings_profile_controller_test.rb Adds coverage for the Profile “options” payload and legacy timezone pinning behaviour.
test/controllers/settings_appearance_controller_test.rb Adds coverage asserting the Appearance “themes” options payload.
test/controllers/settings_editors_controller_test.rb Adds coverage asserting the Editors “extension_text_types” options payload.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

This branch has not been deployed

No deployments
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.

2 participants