diff --git a/app/controllers/workflows_controller.rb b/app/controllers/workflows_controller.rb index dd75860ff..d4cc5a8c3 100644 --- a/app/controllers/workflows_controller.rb +++ b/app/controllers/workflows_controller.rb @@ -141,7 +141,7 @@ class WorkflowsController < ApplicationController role_ids = Role.all.select(&:consider_workflow?).map(&:id) status_ids = WorkflowTransition.where( :tracker_id => @trackers.map(&:id), :role_id => role_ids - ).uniq.pluck(:old_status_id, :new_status_id).flatten.uniq + ).distinct.pluck(:old_status_id, :new_status_id).flatten.uniq @statuses = IssueStatus.where(:id => status_ids).sorted.to_a.presence end @statuses ||= IssueStatus.sorted.to_a diff --git a/app/models/user.rb b/app/models/user.rb index 11b200f6b..02ba81439 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -566,7 +566,7 @@ class User < Principal end def roles - @roles ||= Role.joins(members: :project).where(["#{Project.table_name}.status <> ?", Project::STATUS_ARCHIVED]).where(Member.arel_table[:user_id].eq(id)).uniq + @roles ||= Role.joins(members: :project).where(["#{Project.table_name}.status <> ?", Project::STATUS_ARCHIVED]).where(Member.arel_table[:user_id].eq(id)).distinct end # Returns the user's bult-in role