fix(uve): add site URL option to copy URL popover in page editor#35617
fix(uve): add site URL option to copy URL popover in page editor#35617gortiz-dotcms wants to merge 9 commits into
Conversation
) The copy URL popover only showed URLs based on the admin login origin. Now a third "Site URL" entry is added when the page's site hostname differs from the current host, letting users copy a link scoped to the selected site. Refs: #35448 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Claude finished @gortiz-dotcms's task in 2m 36s —— View job Review
The change is small, focused, and well-tested. A few things worth a second look: 1. Hardcoded
|
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Hoist liveUrl const to avoid building it twice - Mirror the active host scheme instead of hard-coding https:// - Compare hostnames (not full URLs) for dedup to avoid scheme-mismatch false positives - Guard URL construction with try/catch for malformed site.hostname - Add test: site URL shown using origin scheme when clientHost is absent Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…edup - Lowercase site.hostname before URL construction and comparison to match WHATWG URL.hostname normalization, preventing false-positive Site URL entries when the backend returns mixed-case hostnames - Replace silent catch with console.warn for malformed hostname debugging - Add test: mixed-case hostname treated as duplicate of clientHost Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Extract PageURL type alias to eliminate repeated inline type literal
- Fix port-aware dedup: compare full computed URLs (siteHostUrl !== liveUrl)
instead of hostnames, so a clientHost with a non-standard port no longer
suppresses a genuinely different Site URL
- Revert scheme to hardcoded https:// — DotSite has no protocol field so
borrowing the admin scheme was misleading; add comment explaining rationale
- Remove try/catch: replace with early space-guard (!hostname.includes(' '))
to skip non-addressable hosts like "System Host" without swallowing errors
- Move Site URL to second position (after Live URL, before Current View URL)
so public-facing links are grouped together
- Add TODO for alias-aware dedup
- Add tests: port-only difference shown, "System Host" suppressed,
https always used when clientHost is absent
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…med hostnames - Remove .toLowerCase() call: the WHATWG URL parser normalises host to lowercase automatically so the call was misleading, not functional - Re-add try/catch around URL construction to guard against malformed hostname values that pass the space-check but would produce a broken URL (e.g. accidental scheme prefix) - Extend inline comment to document the http/https dedup edge case on local dev setups Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…RL to last position
- Replace !site.hostname.includes(' ') with !site.systemHost to
correctly exclude the non-addressable System Host via its typed
boolean rather than a fragile English display-name check
- Move Site URL entry to last position [Live, Current View, Site]
to match PR description ("third link") and avoid reshuffling the
two existing entries users already learned
- Compact inline comment block
- Update System Host test to use systemHost: true with normal hostname
- Add systemHost: false to all other site mocks for type accuracy
- Add test: malformed hostname with spaces triggers catch and suppresses
Site URL entry
- Rename port test for clarity
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove stale mirrored-protocol line; site URL now correctly uses https:// as intended and documented - Remove inline comments from $pageURLS computed block Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Closing because PR 35539 already solved the issue
|
What does this PR do?
Adds a third Site URL entry to the copy URL popover in the UVE page editor. Previously, both the Live URL and Current View URL were always built from the admin login origin (or
clientHostfor headless pages), giving users no way to copy a link scoped to the currently selected site's public hostname.The new entry appears only when
site.hostnameis set and it produces a URL that differs from the Live URL already shown, avoiding redundant entries.Fixes
Closes #35448
Changes
edit-ema-editor.component.ts— Extended$pageURLScomputed to push auve.toolbar.page.site.urlentry when the site hostname differs from the current host.Language.properties— Addeduve.toolbar.page.site.url=Site URLi18n key.edit-ema-editor.component.spec.ts— Added three new unit tests covering: site URL shown when hostname differs, suppressed when hostname matches clientHost, and suppressed when hostname is empty.Test plan
https://<site-hostname>/<page-path>clientHostalready matches the site hostname — only two URL entries should appear (no duplicate)yarn nx test portlets-edit-ema-portlet --testPathPattern=edit-ema-editor.component.spec🤖 Generated with Claude Code