Skip to content

Allow selection of unpublished documents in link picker and align display of URLs #19296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

AndyButland
Copy link
Contributor

Prerequisites

  • I have added steps to test this contribution in the description below

Resolves: #19294

Description

The linked issue notes that that the validation we have in place currently prevents selection of an unpublished document in the link picker, and that we supported that in 13.

This PR allows that now, but moving the validation to look at the name for the selected URL, which we will always have, rather than the URL. It also fixes an error that occurred when we didn't get a URL back from the request to retrieve it for the document.

I also noticed that when selecting a document or media URL, we see it's actual URL displayed in the picker. But on the opening of the picker for a pre-selected link, we see the localLink syntax. So I've also aligned this by requesting the actual URL for display when the picker is loaded.

Testing

  • Verify that unpublished documents can now be selected.
  • General test of selecting, saving and reloading links of the different types.

@Copilot Copilot AI review requested due to automatic review settings May 12, 2025 05:57
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enables the selection of unpublished documents in the link picker by switching the validation from the URL property to the name property, and it ensures that the actual URL is displayed rather than the localLink syntax. Key changes include updating the validator in firstUpdated, adding helper methods to retrieve the actual URL for both documents and media, and revising the error message for consistency.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Umbraco.Web.UI.Client/src/packages/multi-url-picker/link-picker-modal/link-picker-modal.element.ts Updates URL validation and display logic by introducing async URL population and helper methods for fetching document and media URLs.
src/Umbraco.Web.UI.Client/src/assets/lang/en.ts Revises the error message to align with the new validation and selection logic.

as the nested `url` may also be `null` or `undefined`.
Copy link
Member

@leekelleher leekelleher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested out, works as described. 👍

@leekelleher leekelleher enabled auto-merge (squash) May 12, 2025 06:41
@leekelleher leekelleher disabled auto-merge May 12, 2025 06:55
@leekelleher leekelleher enabled auto-merge (squash) May 12, 2025 07:29
@leekelleher leekelleher merged commit 23df7f1 into release/16.0 May 12, 2025
22 of 23 checks passed
@leekelleher leekelleher deleted the v16/bugfix/link-picker-urls-and-allow-select-unpublished-documents branch May 12, 2025 07:47
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