Handle current_user being both an admin and a moderator for building user list

This commit is contained in:
Andy Allan 2018-03-14 16:41:07 +08:00
parent 6bcffbf499
commit 283cffdfdb

View file

@ -11,12 +11,11 @@ class IssuesController < ApplicationController
if current_user.moderator?
@issue_types = %w[Note]
@users = User.joins(:roles).where(:user_roles => { :role => "moderator" })
else
@issue_types = %w[DiaryEntry DiaryComment User]
@users = User.joins(:roles).where(:user_roles => { :role => "administrator" })
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