]> source.dussan.org Git - redmine.git/commitdiff
Merged r14049 (#19197).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 8 Mar 2015 09:41:22 +0000 (09:41 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 8 Mar 2015 09:41:22 +0000 (09:41 +0000)
git-svn-id: http://svn.redmine.org/redmine/branches/3.0-stable@14056 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/issue.rb
test/unit/issue_test.rb

index 5a49b0d7bae169b214fe92353dec6f9ec5d14fd6..8777a11f4e11dad5193c125d3bf24b6ebdf48f7a 100644 (file)
@@ -819,12 +819,12 @@ class Issue < ActiveRecord::Base
     end
   end
 
-  # Returns the previous assignee if changed
+  # Returns the previous assignee (user or group) if changed
   def assigned_to_was
     # assigned_to_id_was is reset before after_save callbacks
     user_id = @previous_assigned_to_id || assigned_to_id_was
     if user_id && user_id != assigned_to_id
-      @assigned_to_was ||= User.find_by_id(user_id)
+      @assigned_to_was ||= Principal.find_by_id(user_id)
     end
   end
 
index 33635e7a5795a81d20b6840a5c282e93edab8ef4..72157e5381ace1d46b70a08dbc44cac393960a6f 100644 (file)
@@ -2591,4 +2591,12 @@ class IssueTest < ActiveSupport::TestCase
     issue.tracker = Tracker.find(2)
     assert_equal IssueStatus.find(3), issue.status
   end
+
+  def test_assigned_to_was_with_a_group
+    group = Group.find(10)
+
+    issue = Issue.generate!(:assigned_to => group)
+    issue.reload.assigned_to = nil
+    assert_equal group, issue.assigned_to_was
+  end
 end