Feature #28492 » issue-28492.diff
app/views/settings/_issues.html.erb | ||
---|---|---|
7 | 7 | |
8 | 8 |
<p><%= setting_select :cross_project_subtasks, cross_project_subtasks_options %></p> |
9 | 9 | |
10 |
<p><%= setting_check_box :close_parent_issue_when_its_subtask_is_open %></p> |
|
11 | ||
10 | 12 |
<p><%= setting_check_box :close_duplicate_issues %></p> |
11 | 13 | |
12 | 14 |
<p><%= setting_check_box :issue_group_assignment %></p> |
config/locales/en.yml | ||
---|---|---|
478 | 478 |
setting_new_item_menu_tab: Project menu tab for creating new objects |
479 | 479 |
setting_commit_logs_formatting: Apply text formatting to commit messages |
480 | 480 |
setting_timelog_required_fields: Required fields for time logs |
481 |
setting_close_parent_issue_when_its_subtask_is_open: Close parent issue when its subtask is open |
|
481 | 482 |
setting_close_duplicate_issues: Close duplicate issues automatically |
482 | 483 |
setting_time_entry_list_defaults: Timelog list defaults |
483 | 484 |
setting_timelog_accept_0_hours: Accept time logs with 0 hours |
config/settings.yml | ||
---|---|---|
177 | 177 |
default: 'derived' |
178 | 178 |
link_copied_issue: |
179 | 179 |
default: 'ask' |
180 |
close_parent_issue_when_its_subtask_is_open: |
|
181 |
default: 0 |
|
180 | 182 |
close_duplicate_issues: |
181 | 183 |
default: 1 |
182 | 184 |
issue_group_assignment: |
app/models/issue.rb | ||
---|---|---|
1006 | 1006 |
statuses << default_status if include_default || (new_record? && statuses.empty?) |
1007 | 1007 | |
1008 | 1008 |
statuses = statuses.compact.uniq.sort |
1009 |
if blocked? || descendants.open.any? |
|
1010 |
# cannot close a blocked issue or a parent with open subtasks |
|
1009 |
if blocked? || (!Setting.close_parent_issue_when_its_subtask_is_open? && descendants.open.any?) |
|
1011 | 1010 |
statuses.reject!(&:is_closed?) |
1012 | 1011 |
end |
1013 | 1012 |
if ancestors.open(false).any? |
test/unit/issue_test.rb | ||
---|---|---|
2082 | 2082 |
assert !closed_statuses.empty? |
2083 | 2083 |
end |
2084 | 2084 | |
2085 |
def test_parent_issues_with_open_subtask_dont_allow_closed_statuses |
|
2085 |
def test_parent_issues_with_open_subtask_dont_allow_closed_statuses_if_setting_is_false
|
|
2086 | 2086 |
parent = Issue.generate! |
2087 | 2087 |
child = Issue.generate!(:parent_issue_id => parent.id) |
2088 | 2088 | |
2089 |
allowed_statuses = parent.reload.new_statuses_allowed_to(users(:users_002)) |
|
2090 |
assert allowed_statuses.any? |
|
2091 |
assert_equal [], allowed_statuses.select(&:is_closed?) |
|
2089 |
with_settings :close_parent_issue_when_its_subtask_is_open => 0 do |
|
2090 |
allowed_statuses = parent.reload.new_statuses_allowed_to(users(:users_002)) |
|
2091 |
assert allowed_statuses.any? |
|
2092 |
assert_equal [], allowed_statuses.select(&:is_closed?) |
|
2093 |
end |
|
2094 |
end |
|
2095 | ||
2096 |
def test_parent_issues_with_open_subtask_dont_allow_closed_statuses_if_setting_is_true |
|
2097 |
parent = Issue.generate! |
|
2098 |
child = Issue.generate!(:parent_issue_id => parent.id) |
|
2099 | ||
2100 |
with_settings :close_parent_issue_when_its_subtask_is_open => 1 do |
|
2101 |
allowed_statuses = parent.reload.new_statuses_allowed_to(users(:users_002)) |
|
2102 |
assert allowed_statuses.any? |
|
2103 |
assert allowed_statuses.select(&:is_closed?).any? |
|
2104 |
end |
|
2092 | 2105 |
end |
2093 | 2106 | |
2094 | 2107 |
def test_parent_issues_with_closed_subtask_allow_closed_statuses |