Feature #28492 » issue-28492-20200321.diff
| app/views/settings/_issues.html.erb | ||
|---|---|---|
|
<p><%= setting_select :cross_project_subtasks, cross_project_subtasks_options %></p>
|
||
|
<p><%= setting_check_box :closed_parent_issues_with_open_subtasks %></p>
|
||
|
<p><%= setting_check_box :close_duplicate_issues %></p>
|
||
|
<p><%= setting_check_box :issue_group_assignment %></p>
|
||
| config/locales/en.yml | ||
|---|---|---|
|
setting_timespan_format: Time span format
|
||
|
setting_cross_project_issue_relations: Allow cross-project issue relations
|
||
|
setting_cross_project_subtasks: Allow cross-project subtasks
|
||
|
setting_closed_parent_issues_with_open_subtasks: Allow closed parent issues with open subtasks
|
||
|
setting_issue_list_default_columns: Isuses list defaults
|
||
|
setting_repositories_encodings: Attachments and repositories encodings
|
||
|
setting_emails_header: Email header
|
||
| config/settings.yml | ||
|---|---|---|
|
default: 'derived'
|
||
|
link_copied_issue:
|
||
|
default: 'ask'
|
||
|
closed_parent_issues_with_open_subtasks:
|
||
|
default: 0
|
||
|
close_duplicate_issues:
|
||
|
default: 1
|
||
|
issue_group_assignment:
|
||
| app/models/issue.rb | ||
|---|---|---|
|
# Returns true if this issue can be closed and if not, returns false and populates the reason
|
||
|
def closable?
|
||
|
if descendants.open.any?
|
||
|
if !Setting.closed_parent_issues_with_open_subtasks? && descendants.open.any?
|
||
|
@transition_warning = l(:notice_issue_not_closable_by_open_tasks)
|
||
|
return false
|
||
|
end
|
||
| test/unit/issue_test.rb | ||
|---|---|---|
|
assert !closed_statuses.empty?
|
||
|
end
|
||
|
def test_parent_issues_with_open_subtask_dont_allow_closed_statuses
|
||
|
test "test parent issues with open subtask dont allow closed statuses if setting is false" do
|
||
|
parent = Issue.generate!
|
||
|
child = Issue.generate!(:parent_issue_id => parent.id)
|
||
|
allowed_statuses = parent.reload.new_statuses_allowed_to(users(:users_002))
|
||
|
assert !parent.closable?
|
||
|
assert_equal l(:notice_issue_not_closable_by_open_tasks), parent.transition_warning
|
||
|
assert allowed_statuses.any?
|
||
|
assert_equal [], allowed_statuses.select(&:is_closed?)
|
||
|
with_settings :closed_parent_issues_with_open_subtasks => 0 do
|
||
|
allowed_statuses = parent.reload.new_statuses_allowed_to(users(:users_002))
|
||
|
assert !parent.closable?
|
||
|
assert_equal l(:notice_issue_not_closable_by_open_tasks), parent.transition_warning
|
||
|
assert allowed_statuses.any?
|
||
|
assert_equal [], allowed_statuses.select(&:is_closed?)
|
||
|
end
|
||
|
end
|
||
|
test "test parent issues with open subtask allow closed statuses if setting is true" do
|
||
|
parent = Issue.generate!
|
||
|
child = Issue.generate!(:parent_issue_id => parent.id)
|
||
|
with_settings :closed_parent_issues_with_open_subtasks => 1 do
|
||
|
allowed_statuses = parent.reload.new_statuses_allowed_to(users(:users_002))
|
||
|
assert parent.closable?
|
||
|
assert_nil parent.transition_warning
|
||
|
assert allowed_statuses.any?
|
||
|
assert allowed_statuses.select(&:is_closed?).any?
|
||
|
end
|
||
|
end
|
||
|
def test_parent_issues_with_closed_subtask_allow_closed_statuses
|
||
- « Previous
- 1
- …
- 4
- 5
- 6
- Next »