Feature #28492 » issue-28492-20200321.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 :closed_parent_issues_with_open_subtasks %></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 | ||
---|---|---|
420 | 420 |
setting_timespan_format: Time span format |
421 | 421 |
setting_cross_project_issue_relations: Allow cross-project issue relations |
422 | 422 |
setting_cross_project_subtasks: Allow cross-project subtasks |
423 |
setting_closed_parent_issues_with_open_subtasks: Allow closed parent issues with open subtasks |
|
423 | 424 |
setting_issue_list_default_columns: Isuses list defaults |
424 | 425 |
setting_repositories_encodings: Attachments and repositories encodings |
425 | 426 |
setting_emails_header: Email header |
config/settings.yml | ||
---|---|---|
177 | 177 |
default: 'derived' |
178 | 178 |
link_copied_issue: |
179 | 179 |
default: 'ask' |
180 |
closed_parent_issues_with_open_subtasks: |
|
181 |
default: 0 |
|
180 | 182 |
close_duplicate_issues: |
181 | 183 |
default: 1 |
182 | 184 |
issue_group_assignment: |
app/models/issue.rb | ||
---|---|---|
972 | 972 | |
973 | 973 |
# Returns true if this issue can be closed and if not, returns false and populates the reason |
974 | 974 |
def closable? |
975 |
if descendants.open.any? |
|
975 |
if !Setting.closed_parent_issues_with_open_subtasks? && descendants.open.any?
|
|
976 | 976 |
@transition_warning = l(:notice_issue_not_closable_by_open_tasks) |
977 | 977 |
return false |
978 | 978 |
end |
test/unit/issue_test.rb | ||
---|---|---|
2099 | 2099 |
assert !closed_statuses.empty? |
2100 | 2100 |
end |
2101 | 2101 | |
2102 |
def test_parent_issues_with_open_subtask_dont_allow_closed_statuses
|
|
2102 |
test "test parent issues with open subtask dont allow closed statuses if setting is false" do
|
|
2103 | 2103 |
parent = Issue.generate! |
2104 | 2104 |
child = Issue.generate!(:parent_issue_id => parent.id) |
2105 | ||
2106 |
allowed_statuses = parent.reload.new_statuses_allowed_to(users(:users_002)) |
|
2107 | ||
2108 |
assert !parent.closable? |
|
2109 |
assert_equal l(:notice_issue_not_closable_by_open_tasks), parent.transition_warning |
|
2110 | ||
2111 |
assert allowed_statuses.any? |
|
2112 |
assert_equal [], allowed_statuses.select(&:is_closed?) |
|
2105 |
with_settings :closed_parent_issues_with_open_subtasks => 0 do |
|
2106 |
allowed_statuses = parent.reload.new_statuses_allowed_to(users(:users_002)) |
|
2107 |
assert !parent.closable? |
|
2108 |
assert_equal l(:notice_issue_not_closable_by_open_tasks), parent.transition_warning |
|
2109 |
assert allowed_statuses.any? |
|
2110 |
assert_equal [], allowed_statuses.select(&:is_closed?) |
|
2111 |
end |
|
2112 |
end |
|
2113 | ||
2114 |
test "test parent issues with open subtask allow closed statuses if setting is true" do |
|
2115 |
parent = Issue.generate! |
|
2116 |
child = Issue.generate!(:parent_issue_id => parent.id) |
|
2117 |
with_settings :closed_parent_issues_with_open_subtasks => 1 do |
|
2118 |
allowed_statuses = parent.reload.new_statuses_allowed_to(users(:users_002)) |
|
2119 |
assert parent.closable? |
|
2120 |
assert_nil parent.transition_warning |
|
2121 |
assert allowed_statuses.any? |
|
2122 |
assert allowed_statuses.select(&:is_closed?).any? |
|
2123 |
end |
|
2113 | 2124 |
end |
2114 | 2125 | |
2115 | 2126 |
def test_parent_issues_with_closed_subtask_allow_closed_statuses |
- « Previous
- 1
- …
- 4
- 5
- 6
- Next »