Add phase 3: comments and cooking mode

- Comments on visible recipes; author and admin may delete; per-user
  hourly rate limit (COMMENT_RATE_LIMIT_PER_HOUR)
- Cooking mode with large text, tick-off checklists, serving scaling and
  Screen Wake Lock to keep the display on
- Serving calculator auto-submits on change
- Privacy tests cover comment and cooking-mode URLs

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Kyle Dammann
2026-10-30 21:39:15 +01:00
co-authored by Claude Opus 5.5
parent 6f7e4f92ca
commit 9256e94286
14 changed files with 342 additions and 16 deletions
+9 -4
View File
@@ -5,7 +5,7 @@ import pytest
from django.test import Client
from django.urls import reverse
from recipes.models import Favorite, Recipe, RecipeImage
from recipes.models import Comment, Favorite, Recipe, RecipeImage
from .recipe_helpers import image_upload, make_recipe
@@ -22,6 +22,7 @@ def private_recipe(user):
ingredients=f"500 g {SECRET_INGREDIENT}", tags=(SECRET_TAG,))
owner_client(user).post(reverse("recipes:photo_upload", args=[recipe.pk]), {"photos": [image_upload()]})
assert recipe.images.count() == 1
Comment.objects.create(recipe=recipe, author=user, text="Eigene Notiz im Kommentar")
return recipe
@@ -68,12 +69,15 @@ def post_urls(recipe, image):
def extra_get_urls(recipe, image):
"""Hook for later features (comments, cooking mode, …)."""
return []
return [reverse("recipes:cook", args=[recipe.pk]), reverse("recipes:cook", args=[recipe.pk]) + "?portionen=2"]
def extra_post_urls(recipe, image):
return []
comment = recipe.comments.first()
return [
reverse("recipes:comment_create", args=[recipe.pk]),
reverse("recipes:comment_delete", args=[recipe.pk, comment.pk]),
]
def test_owner_sees_everything(user, private_recipe, image):
@@ -96,6 +100,7 @@ def test_outsider_gets_404_on_every_post_url(outsider, private_recipe, image):
assert private_recipe.title == SECRET_TITLE and not private_recipe.is_public
assert RecipeImage.objects.filter(pk=image.pk).exists()
assert not Favorite.objects.exists()
assert list(private_recipe.comments.values_list("text", flat=True)) == ["Eigene Notiz im Kommentar"]
@pytest.mark.parametrize(