@@ -237,7 +237,7 class Issue < ActiveRecord::Base | |||||
237 | if !user.allowed_to?(:manage_subtasks, project) |
|
237 | if !user.allowed_to?(:manage_subtasks, project) | |
238 | attrs.delete('parent_issue_id') |
|
238 | attrs.delete('parent_issue_id') | |
239 | elsif !attrs['parent_issue_id'].blank? |
|
239 | elsif !attrs['parent_issue_id'].blank? | |
240 | attrs.delete('parent_issue_id') unless Issue.visible(user).exists?(attrs['parent_issue_id']) |
|
240 | attrs.delete('parent_issue_id') unless Issue.visible(user).exists?(attrs['parent_issue_id'].to_i) | |
241 | end |
|
241 | end | |
242 | end |
|
242 | end | |
243 |
|
243 |
@@ -499,6 +499,20 class IssuesControllerTest < ActionController::TestCase | |||||
499 | assert_equal Issue.find(2), issue.parent |
|
499 | assert_equal Issue.find(2), issue.parent | |
500 | end |
|
500 | end | |
501 |
|
501 | |||
|
502 | def test_post_create_subissue_with_non_numeric_parent_id | |||
|
503 | @request.session[:user_id] = 2 | |||
|
504 | ||||
|
505 | assert_difference 'Issue.count' do | |||
|
506 | post :create, :project_id => 1, | |||
|
507 | :issue => {:tracker_id => 1, | |||
|
508 | :subject => 'This is a child issue', | |||
|
509 | :parent_issue_id => 'ABC'} | |||
|
510 | end | |||
|
511 | issue = Issue.find_by_subject('This is a child issue') | |||
|
512 | assert_not_nil issue | |||
|
513 | assert_nil issue.parent | |||
|
514 | end | |||
|
515 | ||||
502 | def test_post_create_should_send_a_notification |
|
516 | def test_post_create_should_send_a_notification | |
503 | ActionMailer::Base.deliveries.clear |
|
517 | ActionMailer::Base.deliveries.clear | |
504 | @request.session[:user_id] = 2 |
|
518 | @request.session[:user_id] = 2 |
General Comments 0
You need to be logged in to leave comments.
Login now