Skip to content

fix: settings cleanup - #185

Merged
justlevine merged 4 commits into
fix/load-translationsfrom
fix/settings-cleanup
Oct 26, 2026
Merged

justlevine merged 4 commits into
fix/load-translationsfrom
fix/settings-cleanup

Conversation

@justlevine

@justlevine justlevine commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

What

Cleans up the settings screen and how brand site data is stored:

  • Site type setup moves from a modal into the settings page.
  • Brand site API keys are now stored encrypted, and neither they nor the consumer key are exposed through /wp/v2/settings.
  • Brand site URLs must be http or https.

Why

Aligns with OneSearch:

  • The site type modal was a separate onboarding bundle and stylesheet, injected into the footer of the Plugins page and every OneDesign screen. It was a lot of code for one dropdown, and it opened on top of the screen.
  • onedesign_shared_sites was registered with show_in_rest, so every brand site's API key came back in plain text from /wp/v2/settings. The consumer key was exposed there too: core returned the encrypted value, and a key saved through that route would be stored unencrypted.
  • isValidUrl() accepted any URL that new URL() could parse, including javascript: and ftp:.
  • settings/index.tsx held the whole page, and the components each declared their own copy of the brand site and notice types.

Related Issue(s):

How

  • URLs: isValidUrl() checks for the http: or https: protocol, and the URL field's help text says so.
  • Settings page: the page moves from settings/index.tsx into settings/page.tsx. MultiSites, SiteModal and SiteTable now use its BrandSite, NoticeType and defaultBrandSite types, and imports use the @/ alias. The @wordpress/dependency-group lint rule is dropped, since the files no longer use those comment groups.
  • Site type: a new SiteTypeSettings card shows on the settings page while no site type is set. It saves to /wp/v2/settings and reloads the page. The onboarding entry point, script, stylesheet, footer markup and body class are removed. On the Plugins page and the Dashboard, a dismissible admin notice links to the settings page instead. SiteType lives in the new types/global.d.ts.
  • Brand keys: set_shared_sites() encrypts each key with Encryptor, and get_shared_sites() decrypts it. onedesign_shared_sites and onedesign_consumer_api_key are no longer registered with show_in_rest. The OneDesign REST routes still read and write them.
  • Adds PHPUnit tests for Admin and Settings, and Vitest tests for SiteTypeSettings and isValidUrl(). Removes the e2e test for the old modal.

AI Disclosure

Claude Code migrated the draft changes from OneSearch, wrote the tests and the initial draft of the PR description.

Testing Instructions

Screenshots

Additional Info

Brand keys saved before this PR aren't migrated. They're stored unencrypted, so they read back empty and have to be re-entered on the governing site.

Checklist

  • I have read the Contribution Guidelines.
  • I have read the Development Guidelines.
  • I have added necessary tests to cover my changes.
  • I have updated the project documentation as needed.
  • My code has detailed inline documentation.
  • My code is tested to the best of my abilities.
  • My code passes all lints, tests, and checks.
Open WordPress Playground Preview

@justlevine
justlevine added this pull request to stack #181 October 25, 2026 21:04
@justlevine justlevine changed the title fix: fix: settings cleanup Oct 25, 2026
@justlevine
justlevine requested review from Kallyan01, Utsav-Ladani and up1512001 and removed request for Kallyan01 October 25, 2026 21:24
@justlevine
justlevine merged commit a2ae600 into main Oct 26, 2026
18 of 19 checks passed
@justlevine
justlevine deleted the fix/settings-cleanup branch October 26, 2026 09:52
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