From: Jean-Philippe Lang Date: Sat, 7 Mar 2015 08:20:18 +0000 (+0000) Subject: Missing notification if previous assignee was a group (#19197). X-Git-Tag: 3.1.0~224 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3789a8539e39bd3afe70b99b5eee7b52e3ed584f;p=redmine.git Missing notification if previous assignee was a group (#19197). git-svn-id: http://svn.redmine.org/redmine/trunk@14049 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/models/issue.rb b/app/models/issue.rb index dcc3930a5..8df0082d0 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -830,12 +830,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 diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index 7f3e9484d..25ccb0812 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -2614,4 +2614,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