Feature #31427 » note-11-diff-and-test.patch
| app/controllers/journals_controller.rb | ||
|---|---|---|
|
if @journal
|
||
|
user = @journal.user
|
||
|
text = @journal.notes
|
||
|
@content = +"#{ll(Setting.default_language, :text_user_wrote_in, {:value => user, :link => "#note-#{params[:journal_indice]}"})}\n> "
|
||
|
indice = params[:journal_indice]
|
||
|
if indice.blank?
|
||
|
indice = @journal.issue.visible_journals_with_index.find{|j| j.id == @journal.id}.indice
|
||
|
end
|
||
|
@content = +"#{ll(Setting.default_language, :text_user_wrote_in, {:value => user, :link => "#note-#{indice}"})}\n> "
|
||
|
else
|
||
|
user = @issue.author
|
||
|
text = @issue.description
|
||
| test/functional/journals_controller_test.rb | ||
|---|---|---|
|
assert_include '> A comment with a private version', response.body
|
||
|
end
|
||
|
def test_reply_to_note_without_journal_indice_params
|
||
|
@request.session[:user_id] = 2
|
||
|
# Verify that the :indice method has been called
|
||
|
Journal.any_instance.expects(:indice).returns(2).at_least_once
|
||
|
get :new, :params => {
|
||
|
:id => 6,
|
||
|
:journal_id => 4,
|
||
|
:journal_indice => nil
|
||
|
},
|
||
|
:xhr => true
|
||
|
assert_response :success
|
||
|
assert_equal 'text/javascript', response.content_type
|
||
|
assert_include 'Redmine Admin wrote in #note-2:', response.body
|
||
|
assert_include '> A comment with a private version', response.body
|
||
|
end
|
||
|
def test_reply_to_private_note_should_fail_without_permission
|
||
|
journal = Journal.create!(:journalized => Issue.find(2), :notes => 'Privates notes', :private_notes => true)
|
||
|
@request.session[:user_id] = 2
|
||