Private issue notes (#1554).

Adds 2 new permissions for viewing/adding private comments to issues.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10547 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-10-03 21:36:19 +00:00
parent bb1563f23f
commit 0178b5a2fe
27 changed files with 440 additions and 86 deletions
@@ -62,9 +62,9 @@ class IssuesControllerTransactionTest < ActionController::TestCase
:id => issue.id,
:issue => {
:fixed_version_id => 4,
:notes => 'My notes',
:lock_version => (issue.lock_version - 1)
},
:notes => 'My notes',
:time_entry => { :hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id }
end
end
@@ -93,9 +93,9 @@ class IssuesControllerTransactionTest < ActionController::TestCase
:id => issue.id,
:issue => {
:fixed_version_id => 4,
:notes => 'My notes',
:lock_version => (issue.lock_version - 1)
},
:notes => 'My notes',
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}},
:time_entry => { :hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id }
end
@@ -116,15 +116,14 @@ class IssuesControllerTransactionTest < ActionController::TestCase
put :update, :id => issue.id,
:issue => {
:fixed_version_id => 4,
:notes => '',
:lock_version => (issue.lock_version - 1)
},
:notes => ''
}
assert_tag 'div', :attributes => {:class => 'conflict'}
assert_tag 'input', :attributes => {:name => 'conflict_resolution', :value => 'overwrite'}
assert_no_tag 'input', :attributes => {:name => 'conflict_resolution', :value => 'add_notes'}
assert_tag 'input', :attributes => {:name => 'conflict_resolution', :value => 'cancel'}
end
def test_update_stale_issue_should_show_conflicting_journals
@@ -133,9 +132,9 @@ class IssuesControllerTransactionTest < ActionController::TestCase
put :update, :id => 1,
:issue => {
:fixed_version_id => 4,
:notes => '',
:lock_version => 2
},
:notes => '',
:last_journal_id => 1
assert_not_nil assigns(:conflict_journals)
@@ -151,9 +150,9 @@ class IssuesControllerTransactionTest < ActionController::TestCase
put :update, :id => 1,
:issue => {
:fixed_version_id => 4,
:notes => '',
:lock_version => 2
},
:notes => '',
:last_journal_id => ''
assert_not_nil assigns(:conflict_journals)
@@ -164,6 +163,18 @@ class IssuesControllerTransactionTest < ActionController::TestCase
:descendant => {:content => /Journal notes/}
end
def test_update_stale_issue_should_show_private_journals_with_permission_only
journal = Journal.create!(:journalized => Issue.find(1), :notes => 'Privates notes', :private_notes => true, :user_id => 1)
@request.session[:user_id] = 2
put :update, :id => 1, :issue => {:fixed_version_id => 4, :lock_version => 2}, :last_journal_id => ''
assert_include journal, assigns(:conflict_journals)
Role.find(1).remove_permission! :view_private_notes
put :update, :id => 1, :issue => {:fixed_version_id => 4, :lock_version => 2}, :last_journal_id => ''
assert_not_include journal, assigns(:conflict_journals)
end
def test_update_stale_issue_with_overwrite_conflict_resolution_should_update
@request.session[:user_id] = 2
@@ -171,9 +182,9 @@ class IssuesControllerTransactionTest < ActionController::TestCase
put :update, :id => 1,
:issue => {
:fixed_version_id => 4,
:notes => 'overwrite_conflict_resolution',
:lock_version => 2
},
:notes => 'overwrite_conflict_resolution',
:conflict_resolution => 'overwrite'
end
@@ -192,9 +203,9 @@ class IssuesControllerTransactionTest < ActionController::TestCase
put :update, :id => 1,
:issue => {
:fixed_version_id => 4,
:notes => 'add_notes_conflict_resolution',
:lock_version => 2
},
:notes => 'add_notes_conflict_resolution',
:conflict_resolution => 'add_notes'
end
@@ -213,9 +224,9 @@ class IssuesControllerTransactionTest < ActionController::TestCase
put :update, :id => 1,
:issue => {
:fixed_version_id => 4,
:notes => 'add_notes_conflict_resolution',
:lock_version => 2
},
:notes => 'add_notes_conflict_resolution',
:conflict_resolution => 'cancel'
end