64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'app/models/issue_status.rb', line 64
def self.new_statuses_allowed(status, roles, tracker, author=false, assignee=false)
if roles.present? && tracker
status_id = status.try(:id) || 0
scope = IssueStatus.
joins(:workflow_transitions_as_new_status).
where(:workflows => {:old_status_id => status_id, :role_id => roles.map(&:id), :tracker_id => tracker.id})
unless author && assignee
if author || assignee
scope = scope.where("author = ? OR assignee = ?", author, assignee)
else
scope = scope.where("author = ? AND assignee = ?", false, false)
end
end
scope.distinct.to_a.sort
else
[]
end
end
|