@@ -242,8 +242,11 class Changeset < ActiveRecord::Base | |||||
242 | end |
|
242 | end | |
243 | Redmine::Hook.call_hook(:model_changeset_scan_commit_for_issue_ids_pre_issue_update, |
|
243 | Redmine::Hook.call_hook(:model_changeset_scan_commit_for_issue_ids_pre_issue_update, | |
244 | { :changeset => self, :issue => issue, :action => action }) |
|
244 | { :changeset => self, :issue => issue, :action => action }) | |
245 | unless issue.save |
|
245 | ||
246 | logger.warn("Issue ##{issue.id} could not be saved by changeset #{id}: #{issue.errors.full_messages}") if logger |
|
246 | if issue.changes.any? | |
|
247 | unless issue.save | |||
|
248 | logger.warn("Issue ##{issue.id} could not be saved by changeset #{id}: #{issue.errors.full_messages}") if logger | |||
|
249 | end | |||
247 | end |
|
250 | end | |
248 | issue |
|
251 | issue | |
249 | end |
|
252 | end |
@@ -163,6 +163,30 class ChangesetTest < ActiveSupport::TestCase | |||||
163 | assert_equal [1,2,3], c.issue_ids.sort |
|
163 | assert_equal [1,2,3], c.issue_ids.sort | |
164 | end |
|
164 | end | |
165 |
|
165 | |||
|
166 | def test_update_keywords_with_changes_should_create_journal | |||
|
167 | issue = Issue.generate!(:project_id => 1, :status_id => 1) | |||
|
168 | ||||
|
169 | with_settings :commit_update_keywords => [{'keywords' => 'fixes', 'status_id' => '3'}] do | |||
|
170 | assert_difference 'Journal.count' do | |||
|
171 | c = Changeset.generate!(:repository => Project.find(1).repository,:comments => "Fixes ##{issue.id}") | |||
|
172 | assert_include c.id, issue.reload.changeset_ids | |||
|
173 | journal = Journal.order('id DESC').first | |||
|
174 | assert_equal 1, journal.details.count | |||
|
175 | end | |||
|
176 | end | |||
|
177 | end | |||
|
178 | ||||
|
179 | def test_update_keywords_without_change_should_not_create_journal | |||
|
180 | issue = Issue.generate!(:project_id => 1, :status_id => 3) | |||
|
181 | ||||
|
182 | with_settings :commit_update_keywords => [{'keywords' => 'fixes', 'status_id' => '3'}] do | |||
|
183 | assert_no_difference 'Journal.count' do | |||
|
184 | c = Changeset.generate!(:repository => Project.find(1).repository,:comments => "Fixes ##{issue.id}") | |||
|
185 | assert_include c.id, issue.reload.changeset_ids | |||
|
186 | end | |||
|
187 | end | |||
|
188 | end | |||
|
189 | ||||
166 | def test_update_keywords_with_multiple_rules |
|
190 | def test_update_keywords_with_multiple_rules | |
167 | with_settings :commit_update_keywords => [ |
|
191 | with_settings :commit_update_keywords => [ | |
168 | {'keywords' => 'fixes, closes', 'status_id' => '5'}, |
|
192 | {'keywords' => 'fixes, closes', 'status_id' => '5'}, |
General Comments 0
You need to be logged in to leave comments.
Login now