Refactor recipe editing logic to use User's method for permission check and update template accordingly

This commit is contained in:
Greg Burri 2025-04-28 12:52:45 +02:00
parent be6905cc3b
commit c296689c6b
4 changed files with 9 additions and 7 deletions

View file

@ -6,7 +6,7 @@
<h2 class="recipe-title" >{{ recipe.title }}</h2>
{% if let Some(user) = context.user %}
{% if crate::data::model::can_user_edit_recipe(user, recipe) %}
{% if user.can_edit_recipe(recipe) %}
<a class="edit-recipe button" href="/{{ context.tr.current_lang_code() }}/recipe/edit/{{ recipe.id }}" >Edit</a>
{% endif %}
{% endif %}