fix(sites): default new sites to onlyOtherSite when a primary exists#135
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a new site is created through the
POST /api/siteswebhook and its owneralready has a site flagged
isAccountMain, the new site now defaults toauthMode: 'onlyOtherSite'pointing at the primary site's host, instead offalling back to
onlyBackOffice.Why:
toggleMainSitealready rewrites every existing sibling site toonlyOtherSitewhen a site is promoted to primary, but sites created afterwardswere left on
onlyBackOffice— so a newly added secondary portal delegated loginto 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(
onlyBackOfficeon a secondary site is a meaningless configuration) but it doesmean 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
onlyOtherSitemode.