Allow setting an issue's notes via params[:issue][:notes]. (XML API)

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4048 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis 2010-08-27 20:08:59 +00:00
parent b925325ddb
commit f92dcdf50a
2 changed files with 16 additions and 6 deletions

View File

@ -270,7 +270,7 @@ private
@edit_allowed = User.current.allowed_to?(:edit_issues, @project)
@time_entry = TimeEntry.new
@notes = params[:notes]
@notes = params[:notes] || (params[:issue].present? ? params[:issue][:notes] : nil)
@issue.init_journal(User.current, @notes)
# User can change issue attributes only if he has :edit permission or if a workflow transition is allowed
if (@edit_allowed || !@allowed_statuses.empty?) && params[:issue]

View File

@ -198,7 +198,7 @@ class IssuesApiTest < ActionController::IntegrationTest
setup do
@issue_count = Issue.count
@journal_count = Journal.count
@attributes = {:subject => 'API update'}
@attributes = {:subject => 'API update', :notes => 'A new note'}
put '/issues/1.xml', {:issue => @attributes}, :authorization => credentials('jsmith')
end
@ -214,10 +214,15 @@ class IssuesApiTest < ActionController::IntegrationTest
assert_equal Journal.count, @journal_count + 1
end
should "add the note to the journal" do
journal = Journal.last
assert_equal "A new note", journal.notes
end
should "update the issue" do
issue = Issue.find(1)
@attributes.each do |attribute, value|
assert_equal value, issue.send(attribute)
assert_equal value, issue.send(attribute) unless attribute == :notes
end
end
@ -252,7 +257,7 @@ class IssuesApiTest < ActionController::IntegrationTest
setup do
@issue_count = Issue.count
@journal_count = Journal.count
@attributes = {:subject => 'API update'}
@attributes = {:subject => 'API update', :notes => 'A new note'}
put '/issues/1.json', {:issue => @attributes}, :authorization => credentials('jsmith')
end
@ -268,10 +273,15 @@ class IssuesApiTest < ActionController::IntegrationTest
assert_equal Journal.count, @journal_count + 1
end
should "add the note to the journal" do
journal = Journal.last
assert_equal "A new note", journal.notes
end
should "update the issue" do
issue = Issue.find(1)
@attributes.each do |attribute, value|
assert_equal value, issue.send(attribute)
assert_equal value, issue.send(attribute) unless attribute == :notes
end
end