Skip to content

fix(sites): default new sites to onlyOtherSite when a primary exists#135

Merged
albanm merged 2 commits into
masterfrom
fix-new-secondary-site
Jul 9, 2026
Merged

fix(sites): default new sites to onlyOtherSite when a primary exists#135
albanm merged 2 commits into
masterfrom
fix-new-secondary-site

Conversation

@albanm

@albanm albanm commented Jul 9, 2026

Copy link
Copy Markdown
Member

When a new site is created through the POST /api/sites webhook and its owner
already has a site flagged isAccountMain, the new site now defaults to
authMode: 'onlyOtherSite' pointing at the primary site's host, instead of
falling back to onlyBackOffice.

Why: toggleMainSite already rewrites every existing sibling site to
onlyOtherSite when a site is promoted to primary, but sites created afterwards
were left on onlyBackOffice — so a newly added secondary portal delegated login
to the back-office rather than to the account's primary site.

Heads-up: the new branch also overrides an explicitly-passed
authMode: 'onlyBackOffice', not just an absent one. This is intentional
(onlyBackOffice on a secondary site is a meaningless configuration) but it does
mean the portals manager can no longer pin a secondary site to that mode.
Existing deployments will see the next site created for an org with a primary
site come up in onlyOtherSite mode.

albanm added 2 commits July 9, 2026 11:49
…ry site

When a site is toggled to isAccountMain, toggleMainSite switches all sibling
sites of the same owner to authMode=onlyOtherSite pointing at the primary.
The POST /api/sites webhook (used by the portals manager) did not follow the
same rule and left the new site in onlyBackOffice, requiring a manual patch
to align it with the rest of the account's sites.
@albanm albanm merged commit 67cf001 into master Jul 9, 2026
3 of 4 checks passed
@albanm albanm deleted the fix-new-secondary-site branch July 9, 2026 12:56
@github-actions github-actions Bot added the fix label Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant