Improve Pending Trusted Publishers UX when project already exists#16515
Merged
Improve Pending Trusted Publishers UX when project already exists#16515
Conversation
8ec4158 to
f6b455a
Compare
di
approved these changes
Aug 19, 2024
twm
reviewed
Aug 20, 2024
Comment on lines
+45
to
+48
| markupsafe.Markup( | ||
| f"This project already exists, use the project's publishing" | ||
| f" settings <a href='{url}'>here</a> to create a Trusted" | ||
| f" Publisher for it." |
Member
There was a problem hiding this comment.
Yeah -- I think we need to either push this down a layer, or make sure the snippet generated here passes through _(...) correctly.
Contributor
Author
There was a problem hiding this comment.
I'm looking into it now
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.
This PR changes the error message displayed when a user tries to create a Pending Trusted Publisher for a project that already exists. The new error message includes a link to the regular Trusted Publisher form for that project, with URL parameters that will pre-fill the form with the values the user already input in the Pending form:
The link will be something like:
The main logic change is in
forms/_core.py. The validator for theproject_namefield (validate_project_name()) is changed so that the link to the pre-filled Trusted Publisher form is included in the error message when the project already exists.Creating the link requires us to have access to the
request.route_urlmethod, which we pass the same way theproject_factoryparameter is currently passed to the validator (through the form constructor)See the comment in #14232 (comment) for more context on why we use this approach rather than implicitly creating a Trusted Publisher for the existing project.
Fixes #14232
cc @woodruffw