##// END OF EJS Templates
Fixed: submitting a non numerical parent task input creates a 500 error (#6932)....
Jean-Philippe Lang -
r4300:06b0176a3edd
parent child
Show More
@@ -276,7 +276,7 class Issue < ActiveRecord::Base
276 if !user.allowed_to?(:manage_subtasks, project)
276 if !user.allowed_to?(:manage_subtasks, project)
277 attrs.delete('parent_issue_id')
277 attrs.delete('parent_issue_id')
278 elsif !attrs['parent_issue_id'].blank?
278 elsif !attrs['parent_issue_id'].blank?
279 attrs.delete('parent_issue_id') unless Issue.visible(user).exists?(attrs['parent_issue_id'])
279 attrs.delete('parent_issue_id') unless Issue.visible(user).exists?(attrs['parent_issue_id'].to_i)
280 end
280 end
281 end
281 end
282
282
@@ -525,6 +525,20 class IssuesControllerTest < ActionController::TestCase
525 assert_not_nil issue
525 assert_not_nil issue
526 assert_equal Issue.find(2), issue.parent
526 assert_equal Issue.find(2), issue.parent
527 end
527 end
528
529 def test_post_create_subissue_with_non_numeric_parent_id
530 @request.session[:user_id] = 2
531
532 assert_difference 'Issue.count' do
533 post :create, :project_id => 1,
534 :issue => {:tracker_id => 1,
535 :subject => 'This is a child issue',
536 :parent_issue_id => 'ABC'}
537 end
538 issue = Issue.find_by_subject('This is a child issue')
539 assert_not_nil issue
540 assert_nil issue.parent
541 end
528
542
529 def test_post_create_should_send_a_notification
543 def test_post_create_should_send_a_notification
530 ActionMailer::Base.deliveries.clear
544 ActionMailer::Base.deliveries.clear
General Comments 0
You need to be logged in to leave comments. Login now