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 448b2a5d619e1b97d9d5d20e5c9febe72c878d84..42ae850ba24a039594ee3a9cb9cc6bccea4c5270 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 362100e6a3fe43c674c5995f8bbb1d755d29a2ee..dfaff63b1a2bdc72d87a8d4d34532e2662dd41bb 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 2466561b4349f1a88657915f36d4bd8b1bb16a37..d57bc65aafe3078227f59af41110376f273fee9a 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 da9c5f6c8be7341ef85755e0a19a08c84b4c2747..05344b7a4706e1992d74459f5c996d5a744e6acb 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