[openstreetmap/openstreetmap-website] move #require_administrator to application controller (#2019)

Tom Hughes notifications at github.com
Sun Oct 7 10:48:33 UTC 2018


tomhughes requested changes on this pull request.



> @@ -134,6 +134,20 @@ def require_moderator
     end
   end
 
+  ##
+  # require that the user is a administrator, or fill out a helpful error message
+  # and return them to the user/login page.
+  def require_administrator
+    if current_user
+      unless current_user.administrator?
+        flash[:error] = t("user.filter.not_an_administrator")

That needs to be `users.filter.not_an_administrator` as that key doesn't exist - looks like you chose to copy the one that is broken since @gravitystorm renamed `user` to `users` last week ;-)

The `user_role` version can also be removed from `config/locales/en.yml` as it will no longer be used once this is merged.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/2019#pullrequestreview-162285706
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20181007/dec9e20a/attachment-0001.html>


More information about the rails-dev mailing list