Patch #22345 » 0001-Do-not-propose-trackers-which-disallow-parent_issue_.patch
| app/helpers/issues_helper.rb | ||
|---|---|---|
|
# Returns a link for adding a new subtask to the given issue
|
||
|
def link_to_new_subtask(issue)
|
||
|
attrs = {
|
||
|
:tracker_id => issue.tracker,
|
||
|
:parent_issue_id => issue
|
||
|
}
|
||
|
attrs[:tracker_id] = issue.tracker unless issue.tracker.disabled_core_fields.include?('parent_issue_id')
|
||
|
link_to(l(:button_add), new_project_issue_path(issue.project, :issue => attrs))
|
||
|
end
|
||
| app/views/issues/_form.html.erb | ||
|---|---|---|
|
<% end %>
|
||
|
<% if @issue.safe_attribute? 'tracker_id' %>
|
||
|
<p><%= f.select :tracker_id, @issue.project.trackers.collect {|t| [t.name, t.id]}, {:required => true},
|
||
|
<p><%= f.select :tracker_id, @issue.project.trackers.reject { |t| @issue.new_record? && @issue.parent_issue_id.present? && @issue.tracker_id != t.id && t.disabled_core_fields.include?('parent_issue_id') }.collect {|t| [t.name, t.id]}, {:required => true},
|
||
|
:onchange => "updateIssueFrom('#{escape_javascript update_issue_form_path(@project, @issue)}', this)" %></p>
|
||
|
<% end %>
|
||
| test/functional/issues_controller_test.rb | ||
|---|---|---|
|
assert_response 404
|
||
|
end
|
||
|
def test_new_with_parent_id_should_only_propose_valid_trackers
|
||
|
@request.session[:user_id] = 2
|
||
|
t = Tracker.find(3)
|
||
|
assert !t.disabled_core_fields.include?('parent_issue_id')
|
||
|
get :new, :project_id => 1, issue: { parent_issue_id: 1 }
|
||
|
assert_response :success
|
||
|
assert_select 'option', text: /#{t.name}/, count: 1
|
||
|
t.core_fields = Tracker::CORE_FIELDS - ['parent_issue_id']
|
||
|
t.save!
|
||
|
assert t.disabled_core_fields.include?('parent_issue_id')
|
||
|
get :new, :project_id => 1, issue: { parent_issue_id: 1 }
|
||
|
assert_response :success
|
||
|
assert_select 'option', text: /#{t.name}/, count: 0
|
||
|
end
|
||
|
def test_update_form_for_new_issue
|
||
|
@request.session[:user_id] = 2
|
||
|
xhr :post, :new, :project_id => 1,
|
||