From 9acf9ec27c5595baed197c35900cd83f1375cdbd Mon Sep 17 00:00:00 2001 From: Michael Genson <71845777+michael-genson@users.noreply.github.com> Date: Sat, 31 Aug 2024 21:54:10 -0500 Subject: [PATCH] feat: Cross-Household Recipes (#4089) --- .../Domain/Recipe/RecipeActionMenu.vue | 21 +- .../RecipePageParts/RecipePageHeader.vue | 5 +- frontend/composables/recipes/index.ts | 1 + .../recipes/use-recipe-permissions.test.ts | 81 ++++++++ .../recipes/use-recipe-permissions.ts | 34 ++++ frontend/composables/recipes/use-recipes.ts | 6 +- .../pages/g/_groupSlug/recipes/timeline.vue | 3 +- frontend/pages/group/data/recipes.vue | 6 +- mealie/routes/recipe/recipe_crud_routes.py | 18 +- mealie/routes/recipe/timeline_events.py | 13 +- mealie/routes/users/ratings.py | 11 +- mealie/services/recipe/recipe_service.py | 26 ++- .../user_recipe_tests/test_recipe_comments.py | 17 ++ .../test_recipe_cross_household.py | 186 ++++++++++++++++++ .../user_recipe_tests/test_recipe_ratings.py | 44 +++++ .../test_recipe_timeline_events.py | 165 +++++++++++----- 16 files changed, 545 insertions(+), 92 deletions(-) create mode 100644 frontend/composables/recipes/use-recipe-permissions.test.ts create mode 100644 frontend/composables/recipes/use-recipe-permissions.ts create mode 100644 tests/integration_tests/user_recipe_tests/test_recipe_cross_household.py diff --git a/frontend/components/Domain/Recipe/RecipeActionMenu.vue b/frontend/components/Domain/Recipe/RecipeActionMenu.vue index adb0b0b0981..3ad0184d0b0 100644 --- a/frontend/components/Domain/Recipe/RecipeActionMenu.vue +++ b/frontend/components/Domain/Recipe/RecipeActionMenu.vue @@ -21,31 +21,23 @@
- - + +
- + {{ $t("general.edit") }} - - - {{ $t("recipe.locked-by-owner") }} -
@@ -135,7 +128,7 @@ export default defineComponent({ required: true, type: String, }, - locked: { + canEdit: { type: Boolean, default: false, }, diff --git a/frontend/components/Domain/Recipe/RecipePage/RecipePageParts/RecipePageHeader.vue b/frontend/components/Domain/Recipe/RecipePage/RecipePageParts/RecipePageHeader.vue index ed26818b08f..18915641ae2 100644 --- a/frontend/components/Domain/Recipe/RecipePage/RecipePageParts/RecipePageHeader.vue +++ b/frontend/components/Domain/Recipe/RecipePage/RecipePageParts/RecipePageHeader.vue @@ -45,7 +45,7 @@ :recipe="recipe" :slug="recipe.slug" :recipe-scale="recipeScale" - :locked="isOwnGroup && user.id !== recipe.userId && recipe.settings.locked" + :can-edit="canEditRecipe" :name="recipe.name" :logged-in="isOwnGroup" :open="isEditMode" @@ -64,6 +64,7 @@