From e7e12a38c6585763bfa29ff189cf4c9cea646281 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 14 Mar 2018 16:29:47 +0800 Subject: [PATCH] Create a more accurate permissions check message --- app/controllers/issue_comments_controller.rb | 2 +- app/controllers/issues_controller.rb | 2 +- config/locales/en.yml | 2 ++ test/system/issues_test.rb | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/issue_comments_controller.rb b/app/controllers/issue_comments_controller.rb index 448b2a5d6..42ae850ba 100644 --- a/app/controllers/issue_comments_controller.rb +++ b/app/controllers/issue_comments_controller.rb @@ -23,7 +23,7 @@ class IssueCommentsController < ApplicationController def check_permission unless current_user.administrator? || current_user.moderator? - flash[:error] = t("application.require_admin.not_an_admin") + flash[:error] = t("application.require_moderator_or_admin.not_a_moderator_or_admin") redirect_to root_path end end diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 362100e6a..dfaff63b1 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -93,7 +93,7 @@ class IssuesController < ApplicationController def check_permission unless current_user.administrator? || current_user.moderator? - flash[:error] = t("application.require_admin.not_an_admin") + flash[:error] = t("application.require_moderator_or_admin.not_a_moderator_or_admin") redirect_to root_path end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 2466561b4..d57bc65aa 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1789,6 +1789,8 @@ en: not_an_admin: You need to be an admin to perform that action. require_moderator: not_a_moderator: "You need to be a moderator to perform that action." + require_moderator_or_admin: + not_a_moderator_or_admin: You need to be a moderator or an admin to perform that action setup_user_auth: blocked_zero_hour: "You have an urgent message on the OpenStreetMap web site. You need to read the message before you will be able to save your edits." blocked: "Your access to the API has been blocked. Please log-in to the web interface to find out more." diff --git a/test/system/issues_test.rb b/test/system/issues_test.rb index da9c5f6c8..05344b7a4 100644 --- a/test/system/issues_test.rb +++ b/test/system/issues_test.rb @@ -7,7 +7,7 @@ class IssuesTest < ApplicationSystemTestCase sign_in_as(create(:user)) visit issues_path - assert page.has_content?(I18n.t("application.require_admin.not_an_admin")) + assert page.has_content?(I18n.t("application.require_moderator_or_admin.not_a_moderator_or_admin")) end def test_view_no_issues -- 2.39.5