Index: issue.rb =================================================================== --- issue.rb (revision 16557) +++ issue.rb (working copy) @@ -241,6 +241,7 @@ def reload(*args) @workflow_rule_by_attribute = nil @assignable_versions = nil + @assignable_users = nil @relations = nil @spent_hours = nil @total_spent_hours = nil @@ -911,12 +912,15 @@ # Users the issue can be assigned to def assignable_users - users = project.assignable_users(tracker).to_a - users << author if author && author.active? - if assigned_to_id_was.present? && assignee = Principal.find_by_id(assigned_to_id_was) - users << assignee + return @assignable_users unless @assignable_users.nil? + user_ids = [] + user_ids << author_id if author && author.active? + user_ids << assigned_to_id_was if assigned_to_id_was.present? + if project + project_users = project.assignable_users(tracker) + user_ids.concat project_users.reorder(nil).pluck(:id) end - users.uniq.sort + @assignable_users = user_ids.empty? ? [] : Principal.where(:id => user_ids).sorted.to_a end # Versions that the issue can be assigned to