@@ -418,7 +418,7 class Issue < ActiveRecord::Base | |||||
418 |
|
418 | |||
419 | if attrs['parent_issue_id'].present? |
|
419 | if attrs['parent_issue_id'].present? | |
420 | s = attrs['parent_issue_id'].to_s |
|
420 | s = attrs['parent_issue_id'].to_s | |
421 | unless (m = s.match(%r{\A#?(\d+)\z})) && Issue.visible(user).exists?(m[1]) |
|
421 | unless (m = s.match(%r{\A#?(\d+)\z})) && (m[1] == parent_id.to_s || Issue.visible(user).exists?(m[1])) | |
422 | @invalid_parent_issue_id = attrs.delete('parent_issue_id') |
|
422 | @invalid_parent_issue_id = attrs.delete('parent_issue_id') | |
423 | end |
|
423 | end | |
424 | end |
|
424 | end |
@@ -2914,6 +2914,20 class IssuesControllerTest < ActionController::TestCase | |||||
2914 | assert_equal spent_hours_before + 2.5, issue.spent_hours |
|
2914 | assert_equal spent_hours_before + 2.5, issue.spent_hours | |
2915 | end |
|
2915 | end | |
2916 |
|
2916 | |||
|
2917 | def test_put_update_should_preserve_parent_issue_even_if_not_visible | |||
|
2918 | parent = Issue.generate!(:project_id => 1, :is_private => true) | |||
|
2919 | issue = Issue.generate!(:parent_issue_id => parent.id) | |||
|
2920 | assert !parent.visible?(User.find(3)) | |||
|
2921 | @request.session[:user_id] = 3 | |||
|
2922 | ||||
|
2923 | get :edit, :id => issue.id | |||
|
2924 | assert_select 'input[name=?][value=?]', 'issue[parent_issue_id]', parent.id.to_s | |||
|
2925 | ||||
|
2926 | put :update, :id => issue.id, :issue => {:subject => 'New subject', :parent_issue_id => parent.id.to_s} | |||
|
2927 | assert_response 302 | |||
|
2928 | assert_equal parent, issue.parent | |||
|
2929 | end | |||
|
2930 | ||||
2917 | def test_put_update_with_attachment_only |
|
2931 | def test_put_update_with_attachment_only | |
2918 | set_tmp_attachments_directory |
|
2932 | set_tmp_attachments_directory | |
2919 |
|
2933 |
General Comments 0
You need to be logged in to leave comments.
Login now