]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/issues_controller.rb
Handle current_user being both an admin and a moderator for building user list
[rails.git] / app / controllers / issues_controller.rb
index 10b626cd1fc0c7bcfd3dc6568c9bab5f9329337b..c2470dc5b5898218d4c837a0339e6ba5140c2996 100644 (file)
@@ -11,12 +11,11 @@ class IssuesController < ApplicationController
 
     if current_user.moderator?
       @issue_types = %w[Note]
 
     if current_user.moderator?
       @issue_types = %w[Note]
-      @users = User.joins(:roles).where(:user_roles => { :role => "moderator" })
     else
       @issue_types = %w[DiaryEntry DiaryComment User]
     else
       @issue_types = %w[DiaryEntry DiaryComment User]
-      @users = User.joins(:roles).where(:user_roles => { :role => "administrator" })
     end
 
     end
 
+    @users = User.joins(:roles).where(:user_roles => { :role => current_user.roles.map(&:role) }).distinct
     @issues = Issue.where(:assigned_role => current_user.roles.map(&:role))
 
     # If search
     @issues = Issue.where(:assigned_role => current_user.roles.map(&:role))
 
     # If search