summaryrefslogtreecommitdiffstats
path: root/lib/plugins/acts_as_watchable
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-07-09 03:15:32 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-07-09 03:15:32 +0000
commitf416657d563562af639025924834f2960aa54412 (patch)
tree15955e5f0e805d41c1277f15863e2f36875f3f9c /lib/plugins/acts_as_watchable
parent4c78b63d58b7f7fd71b34d88c0aea6dc1fdf76ad (diff)
downloadredmine-f416657d563562af639025924834f2960aa54412.tar.gz
redmine-f416657d563562af639025924834f2960aa54412.zip
When creating issues by receiving an email, watchers created via CC in the mail don't get an email notification (#23278).
git-svn-id: http://svn.redmine.org/redmine/trunk@15609 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/plugins/acts_as_watchable')
-rw-r--r--lib/plugins/acts_as_watchable/lib/acts_as_watchable.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/plugins/acts_as_watchable/lib/acts_as_watchable.rb b/lib/plugins/acts_as_watchable/lib/acts_as_watchable.rb
index 19af8e56c..4bbba854a 100644
--- a/lib/plugins/acts_as_watchable/lib/acts_as_watchable.rb
+++ b/lib/plugins/acts_as_watchable/lib/acts_as_watchable.rb
@@ -40,12 +40,16 @@ module Redmine
# Adds user as a watcher
def add_watcher(user)
+ # Rails does not reset the has_many :through association
+ watcher_users.reset
self.watchers << Watcher.new(:user => user)
end
# Removes user from the watchers list
def remove_watcher(user)
return nil unless user && user.is_a?(User)
+ # Rails does not reset the has_many :through association
+ watcher_users.reset
watchers.where(:user_id => user.id).delete_all
end