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