Feature: Improve Public URL Readability #2482
Merged
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.
What type of PR is this?
(REQUIRED)
What this PR does / why we need it:
(REQUIRED)
The current public URLs are kinda gross:
https://demo.mealie.io/explore/recipes/49279644-6d42-4f5f-80c1-c2e07e599974/easy-30-minute-homemade-chicken-tortilla-soup
So this PR makes them look like this:
https://demo.mealie.io/explore/recipes/home/easy-30-minute-homemade-chicken-tortilla-soup
This is done by adding a slug to groups (which appears in the URL). Similar to the recipe id/slug implementation in #2265, you can pass either an id or a slug, so old public URLs still work, we just generate URLs with slugs now.
Which issue(s) this PR fixes:
(REQUIRED)
N/A
Special notes for your reviewer:
(fill-in or delete this section)
I originally intended to use the group name instead of adding a slug, but unfortunately while group names are unique, they are case sensitive in most databases (including both sqlite and postgres, by default), so "Home" and "home" are both independently valid group names. This is unfortunate because, while URLs definitely can be case-sensitive, it's easy to run into issues with that.
Plus, subjectively, I like how it looks better:
https://demo.mealie.io/explore/recipes/home/easy-30-minute-homemade-chicken-tortilla-soup
https://demo.mealie.io/explore/recipes/Home/easy-30-minute-homemade-chicken-tortilla-soup
Testing
(fill-in or delete this section)
Updated pytest and also manually tested the new public route as well as the old public route (both work).
Release Notes
(REQUIRED)