-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow users to change version slug (#11930)
Basically what I had in my old design doc #6273 - When changing the slug, we check that it's a valid one (lowercase, only number, etc), in case the slug is not valid, we suggest a valid slug based on the invalid one. Why not just transform the value to a valid slug? Changing the slug is a breaking operation, we want to avoid surprises for the user, if they set a slug to "foo/bar", and then the actual slug is "foo-bar", that's unexpected. - `project` is used as s hidden field, following the same pattern we already have for other forms (this way all normal validations like the unique constraint work instead of getting a 500). - Editing the slug is disabled for machine created versions (stable, latest). - I'm not restricting the usage of latest or stable, since those will be non-machine created, similar to what a user does already if they name a version stable/latest. - If a version was active and its slug was changed, the resources attached to the old slug are removed before triggering a new build. - Cache is always purged after deleting resources from the version. I was playing with using the "pattern" attribute for the input, so it validates the slug before submitting the form. ![vlcsnap-2025-01-28-12h30m33s792](https://github.com/user-attachments/assets/1b89a0fc-74e4-4f89-ab37-7498b55708f4) But I think showing the error with the suggested slug works better, maybe we can port that to JS instead as a future improvement. ![Screenshot 2025-01-28 at 12-30-10 rynoh-pdf - test-builds - Read the Docs](https://github.com/user-attachments/assets/a38bb6e8-295c-457c-9a77-702b574d082d) ### Decisions - Expose this as a feature flag first, or just document it right away? ### TODO - Allow changing the slug using the API. - Suggest a redirect from the old slug to the new one. The idea implemented here comes from this comment: readthedocs/meta#147 (reply in thread) ref readthedocs/meta#147
- Loading branch information
Showing
6 changed files
with
325 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.