From 6b771887ab4ac6557abb0602a3aee38745e17044 Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Mon, 23 Jan 2023 09:04:55 +0100 Subject: [PATCH] Fix unprivileged comment actions being visible - Fixes an error when viewing answers containing comments while not logged in - Hides the report option while not logged in --- app/views/actions/_comment.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/actions/_comment.html.haml b/app/views/actions/_comment.html.haml index a83e637f..23b8e408 100644 --- a/app/views/actions/_comment.html.haml +++ b/app/views/actions/_comment.html.haml @@ -6,11 +6,11 @@ %a.dropdown-item.text-danger{ href: "#", data: { action: "ab-comment-destroy", c_id: comment.id } } %i.fa.fa-fw.fa-trash-o = t("voc.delete") - - unless comment.user == current_user + - if user_signed_in? && comment.user != current_user %a.dropdown-item{ href: "#", data: { action: "ab-comment-report", c_id: comment.id } } %i.fa.fa-fw.fa-exclamation-triangle = t("voc.report") - - if current_user.admin? + - if user_signed_in? && current_user&.admin? %a.dropdown-item{ href: rails_admin_path_for_resource(comment), target: "_blank" } %i.fa.fa-fw.fa-gears = t("voc.view_in_rails_admin")