]> git.openstreetmap.org Git - rails.git/blobdiff - app/helpers/user_roles_helper.rb
Handle current_user being both an admin and a moderator for building user list
[rails.git] / app / helpers / user_roles_helper.rb
index b6961cd8b02021715b6f8436bbf293dbf4b28f03..805abb58f38f323889cf2ebb3b1226d2a30234c2 100644 (file)
@@ -1,10 +1,12 @@
 module UserRolesHelper
   def role_icons(user)
 module UserRolesHelper
   def role_icons(user)
-    UserRole::ALL_ROLES.reduce("".html_safe) { |a, e| a + " " + role_icon(user, e) }
+    UserRole::ALL_ROLES.reduce("".html_safe) do |acc, elem|
+      acc + " " + role_icon(user, elem)
+    end
   end
 
   def role_icon(user, role)
   end
 
   def role_icon(user, role)
-    if @user && @user.administrator?
+    if current_user && current_user.administrator?
       if user.has_role?(role)
         image = "roles/#{role}"
         alt = t("user.view.role.revoke.#{role}")
       if user.has_role?(role)
         image = "roles/#{role}"
         alt = t("user.view.role.revoke.#{role}")