summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-09-20 03:57:41 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-09-20 03:57:41 +0000
commitf2711afe65a19c24be1b570abad93e9aa711dc66 (patch)
tree24b6ed41a75fa5f4801f2a8a7d163b8b936460a8
parent8fa5019e69f696ad143d92b059fd37599a6c431c (diff)
downloadredmine-f2711afe65a19c24be1b570abad93e9aa711dc66.tar.gz
redmine-f2711afe65a19c24be1b570abad93e9aa711dc66.zip
Merged r4048 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.0-stable@4118 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/controllers/issues_controller.rb2
-rw-r--r--test/integration/issues_api_test.rb20
2 files changed, 16 insertions, 6 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index f10ba03bf..0364e307c 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -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]
diff --git a/test/integration/issues_api_test.rb b/test/integration/issues_api_test.rb
index a1e2cb703..e26cf643b 100644
--- a/test/integration/issues_api_test.rb
+++ b/test/integration/issues_api_test.rb
@@ -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,13 +273,18 @@ 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
-
+
end
context "PUT /issues/1.json with failed update" do