From 3280df23b93d6bbffbd5dfd648e01242c31f8389 Mon Sep 17 00:00:00 2001 From: Jonas Kohl Date: Sat, 19 Oct 2024 10:29:47 +0200 Subject: Fix bugs --- src/application/templates/bootstrap-3/search.twig | 4 ++-- src/application/templates/bootstrap-3/view_topic.twig | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'src/application/templates/bootstrap-3') diff --git a/src/application/templates/bootstrap-3/search.twig b/src/application/templates/bootstrap-3/search.twig index c8f6315..66bd764 100644 --- a/src/application/templates/bootstrap-3/search.twig +++ b/src/application/templates/bootstrap-3/search.twig @@ -46,8 +46,8 @@ "author": '' ~ (postAuthor ? postAuthor.displayName : __("unknown"))|e("html") ~ '', "post_date": '' ~ post.postDate.format("c")|e("html") ~ '', "topic": '' - ~ (topics[post.topicId].isLocked ? ' ' : '') - ~ (topics[post.topicId] ? topics[post.topicId].title : null)|default("unknown")|e("html") ~ '', + ~ (ctx.topics[post.topicId].isLocked ? ' ' : '') + ~ (ctx.topics[post.topicId] ? ctx.topics[post.topicId].title : null)|default(__("unknown"))|e("html") ~ '', }) }} {% endfor %} diff --git a/src/application/templates/bootstrap-3/view_topic.twig b/src/application/templates/bootstrap-3/view_topic.twig index 008c336..0344fe4 100644 --- a/src/application/templates/bootstrap-3/view_topic.twig +++ b/src/application/templates/bootstrap-3/view_topic.twig @@ -13,6 +13,13 @@ or currentUser.hasPermission(permission("EDIT_OTHER_TOPIC")) ) %} +{% set couldEditPost = + currentUser is not null + and ( + currentUser.hasPermission(permission("EDIT_OWN_POST")) + or currentUser.hasPermission(permission("EDIT_OTHER_POST")) + ) %} + {% set canDelete = currentUser is not null and ( ( @@ -28,7 +35,7 @@ {% block content %} -{% if canEdit %} +{% if couldEditPost %}