1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-19 15:01:14 +00:00

Merged r4414 from trunk.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.0-stable@4415 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2010-11-20 10:23:13 +00:00
parent 2a7a95d746
commit dbb26b08f8
2 changed files with 15 additions and 1 deletions

View File

@ -237,7 +237,7 @@ class Issue < ActiveRecord::Base
if !user.allowed_to?(:manage_subtasks, project) if !user.allowed_to?(:manage_subtasks, project)
attrs.delete('parent_issue_id') attrs.delete('parent_issue_id')
elsif !attrs['parent_issue_id'].blank? elsif !attrs['parent_issue_id'].blank?
attrs.delete('parent_issue_id') unless Issue.visible(user).exists?(attrs['parent_issue_id']) attrs.delete('parent_issue_id') unless Issue.visible(user).exists?(attrs['parent_issue_id'].to_i)
end end
end end

View File

@ -498,6 +498,20 @@ class IssuesControllerTest < ActionController::TestCase
assert_not_nil issue assert_not_nil issue
assert_equal Issue.find(2), issue.parent assert_equal Issue.find(2), issue.parent
end end
def test_post_create_subissue_with_non_numeric_parent_id
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
post :create, :project_id => 1,
:issue => {:tracker_id => 1,
:subject => 'This is a child issue',
:parent_issue_id => 'ABC'}
end
issue = Issue.find_by_subject('This is a child issue')
assert_not_nil issue
assert_nil issue.parent
end
def test_post_create_should_send_a_notification def test_post_create_should_send_a_notification
ActionMailer::Base.deliveries.clear ActionMailer::Base.deliveries.clear