Create a more accurate permissions check message
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 14 Mar 2018 08:29:47 +0000 (16:29 +0800)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 14 Mar 2018 08:29:47 +0000 (16:29 +0800)
app/controllers/issue_comments_controller.rb
app/controllers/issues_controller.rb
config/locales/en.yml
test/system/issues_test.rb

index 448b2a5..42ae850 100644 (file)
@@ -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
index 362100e..dfaff63 100644 (file)
@@ -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
index 2466561..d57bc65 100644 (file)
@@ -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."
index da9c5f6..05344b7 100644 (file)
@@ -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