From 2d01d9b36565790f5eedd39c41a1ad7b34d15f3e Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Wed, 17 Aug 2022 22:25:34 +0200 Subject: [PATCH] Apply review suggestions Co-authored-by: Andreas Nedbal Co-authored-by: Georg Gadinger --- app/controllers/ajax/anonymous_block_controller.rb | 2 +- app/views/answerbox/_header.haml | 4 ++-- app/views/inbox/_entry.haml | 2 +- config/locales/frontend.en.yml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/ajax/anonymous_block_controller.rb b/app/controllers/ajax/anonymous_block_controller.rb index 463e9fb7..ab082751 100644 --- a/app/controllers/ajax/anonymous_block_controller.rb +++ b/app/controllers/ajax/anonymous_block_controller.rb @@ -6,7 +6,7 @@ class Ajax::AnonymousBlockController < AjaxController question = Question.find(params[:question]) - raise Errors::Forbidden if params[:global] && !current_user.has_role?(:moderator) + raise Errors::Forbidden if params[:global] && !current_user.mod? AnonymousBlock.create!( user: params[:global] ? nil : current_user, diff --git a/app/views/answerbox/_header.haml b/app/views/answerbox/_header.haml index e65eb88e..1d49f545 100644 --- a/app/views/answerbox/_header.haml +++ b/app/views/answerbox/_header.haml @@ -18,8 +18,8 @@ %a.dropdown-item{ href: "#", tabindex: -1, data: { action: "ab-question-report", q_id: a.question.id } } %i.fa.fa-exclamation-triangle = t("voc.report") - - if current_user.has_role?(:moderator) && a.question.anonymous? && !a.question.generated? - %a.dropdown-item{ name: "mod-block-anon", data: { q_id: a.question.id } } + - if current_user.mod? && a.question.anonymous? && !a.question.generated? + %a.dropdown-item{ href: "#", name: "mod-block-anon", data: { q_id: a.question.id } } %i.fa.fa-volume-off = t("voc.block_site_wide") - if current_user.has_role? :administrator diff --git a/app/views/inbox/_entry.haml b/app/views/inbox/_entry.haml index 8e788047..dc1931e5 100644 --- a/app/views/inbox/_entry.haml +++ b/app/views/inbox/_entry.haml @@ -24,7 +24,7 @@ %a.dropdown-item{ name: "ib-report", data: { q_id: i.question.id } } %i.fa.fa-fw.fa-warning = t("voc.report") - - if current_user.has_role?(:moderator) && i.question.anonymous? && !i.question.generated? + - if current_user.mod? && i.question.anonymous? && !i.question.generated? %a.dropdown-item{ name: "mod-block-anon", data: { q_id: i.question.id } } %i.fa.fa-fw.fa-volume-off = t("voc.block_site_wide") diff --git a/config/locales/frontend.en.yml b/config/locales/frontend.en.yml index a0677e2d..0e734fd6 100644 --- a/config/locales/frontend.en.yml +++ b/config/locales/frontend.en.yml @@ -48,7 +48,7 @@ en: mod_mute: confirm: title: "Are you sure?" - text: "This will block this user for everyone." + text: "This will mute this user for everyone." report: confirm: title: "Are you sure you want to report this %{type}?"