##// END OF EJS Templates
Fixed: watchers selection lost when issue creation fails (#5406). #watched_by? was fixed in order to work with #watcher_user_ids= used in controllers on unsaved objects....
Jean-Philippe Lang -
r3591:a00d1eabd7c4
parent child
Show More
@@ -47,6 +47,12 class WatcherTest < ActiveSupport::TestCase
47 assert Issue.watched_by(@user).include?(@issue)
47 assert Issue.watched_by(@user).include?(@issue)
48 end
48 end
49
49
50 def test_watcher_user_ids
51 issue = Issue.new
52 issue.watcher_user_ids = ['1', '3']
53 assert issue.watched_by?(User.find(1))
54 end
55
50 def test_recipients
56 def test_recipients
51 @issue.watchers.delete_all
57 @issue.watchers.delete_all
52 @issue.reload
58 @issue.reload
@@ -50,9 +50,9 module Redmine
50 watching ? add_watcher(user) : remove_watcher(user)
50 watching ? add_watcher(user) : remove_watcher(user)
51 end
51 end
52
52
53 # Returns true if object is watched by user
53 # Returns true if object is watched by +user+
54 def watched_by?(user)
54 def watched_by?(user)
55 !!(user && self.watchers.detect {|w| w.user_id == user.id })
55 !!(user && self.watcher_user_ids.detect {|uid| uid == user.id })
56 end
56 end
57
57
58 # Returns an array of watchers' email addresses
58 # Returns an array of watchers' email addresses
General Comments 0
You need to be logged in to leave comments. Login now