Skip to content
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

feat: Allow Cookbooks To Share Names #4186

Conversation

michael-genson
Copy link
Collaborator

@michael-genson michael-genson commented Sep 9, 2024

What type of PR is this?

(REQUIRED)

  • feature

What this PR does / why we need it:

(REQUIRED)

This PR allows cookbooks to share the same name. We want this since cookbooks are per-household, and multiple households may want the same cookbook name (e.g. "Sides").

When multiple cookbooks share the same name, they are assigned different slugs (so slugs are still unique, which we enforce at the DB layer in a previous PR). The logic is similar to how duplicate recipes are handled (although recipes de-dupe name, too). This PR also makes it so when a cookbook's name is updated, so is its slug (so it matches the name).

Which issue(s) this PR fixes:

(REQUIRED)

Closes #4083

Special notes for your reviewer:

Technically we're not stopping users from creating the same cookbook name in one household, so it is possible to do this:
image

I don't really see this as a problem, just figured I'd point it out.

Testing

(fill-in or delete this section)

Pytest for the new cookbooks repo with custom dedupe logic. I also confirmed the frontend handles this fine with cookbook CRUD operations (both in the same household and on two different households).

boc-the-git
boc-the-git previously approved these changes Sep 14, 2024
Copy link
Collaborator

@boc-the-git boc-the-git left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

One question.

mealie/repos/repository_cookbooks.py Outdated Show resolved Hide resolved
@boc-the-git boc-the-git enabled auto-merge (squash) September 15, 2024 11:34
@boc-the-git boc-the-git merged commit dbbd662 into mealie-recipes:mealie-next Sep 15, 2024
13 checks passed
boc-the-git pushed a commit to boc-the-git/mealie that referenced this pull request Sep 28, 2024
boc-the-git pushed a commit to boc-the-git/mealie that referenced this pull request Sep 28, 2024
Choromanski pushed a commit to Choromanski/mealie that referenced this pull request Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task] - Allow Cookbooks to Share the Same Name
2 participants