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