0002-restrict-list-of-statuses-shown-in-workflow-edit-to-.patch

Jens Krämer, 2016-11-07 10:41

Download (1.24 KB)

View differences:

app/controllers/workflows_controller.rb
137 137
  def find_statuses
138 138
    @used_statuses_only = (params[:used_statuses_only] == '0' ? false : true)
139 139
    if @trackers && @used_statuses_only
140
      @statuses = @trackers.map(&:issue_statuses).flatten.uniq.sort.presence
140
      role_ids = Role.all.select(&:consider_workflow?).map(&:id)
141
      status_ids = WorkflowTransition.where(
142
        :tracker_id => @trackers.map(&:id), :role_id => role_ids
143
      ).uniq.pluck(:old_status_id, :new_status_id).flatten.uniq
144
      @statuses = IssueStatus.where(:id => status_ids).sorted.to_a.presence
141 145
    end
142 146
    @statuses ||= IssueStatus.sorted.to_a
143 147
  end
144
-