Patch #40854 ยป optimize-issue-blocked-duplicates.patch
| app/models/issue.rb | ||
|---|---|---|
|
# Returns true if this issue is blocked by another issue that is still open
|
||
|
def blocked?
|
||
|
!relations_to.detect {|ir| ir.relation_type == 'blocks' && !ir.issue_from.closed?}.nil?
|
||
|
return false if relations.empty?
|
||
|
relations_to.where(relation_type: IssueRelation::TYPE_BLOCKS).any? {|ir| !ir.issue_to.closed?}
|
||
|
end
|
||
|
# Returns true if this issue can be closed and if not, returns false and populates the reason
|
||
| ... | ... | |
|
# Returns an array of issues that duplicate this one
|
||
|
def duplicates
|
||
|
relations_to.select {|r| r.relation_type == IssueRelation::TYPE_DUPLICATES}.collect {|r| r.issue_from}
|
||
|
return [] if relations.empty?
|
||
|
relations_to.where(relation_type: IssueRelation::TYPE_DUPLICATES).collect(&:issue_from)
|
||
|
end
|
||
|
# Returns the due date or the target due date if any
|
||