MishkaCmsCore. Runtime. Resources. Validations. PublicAddress
(Mishka CMS Core v0.0.1)
Copy Markdown
View Source
Refuses a page whose public addresses cannot be what it says, or are already another page's.
- A page marked as answering every language (
PageProvision.serves_all_languages?/1) on a path that captures nolangis refused: only alangcapture answers more than one language. - An active page is refused when one of its public addresses is one another active page of its site already answers at. The refusal names that page — its title and its stored path — and the address.
A page's public addresses are MishkaCmsCore.Runtime.PageEditions.urls/3's — a literal page's
one, one per language a page whose only capture is the language answers in — compared as the site
builds them with its primary language unprefixed. Two addresses that are one with a prefix for
every language are one without, so this holds in both URL modes
(MishkaCmsCore.Runtime.Languages.url_mode/1), and a site that switches modes finds no page
hidden behind another: while English is the site's first language, /en/about and /about are
refused together, and so are a literal /fa/about and an /:lang/about answering Persian. A
pattern with any other capture is the template of many addresses, left to the resolver's
precedence — /post/new before /post/:slug.
Asked when the path, the language, extra or active changes, before the write and with the
actor and the authorization the action runs with. The second refusal carries the address in its
vars as :answered_at, which is how MishkaCmsCore.Runtime.PageProvision.create/2 tells it
from any other and leaves the page out of a run instead of raising.
validate {MishkaCmsCore.Runtime.Resources.Validations.PublicAddress, []},
before_action?: true