Make use of #watched_by? in issue form.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3114 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2009-12-02 19:17:42 +00:00
parent 7592a955fb
commit e5dc94fe82
2 changed files with 3 additions and 4 deletions
+2 -3
View File
@@ -46,10 +46,9 @@ module Redmine
watching ? add_watcher(user) : remove_watcher(user)
end
# Returns if object is watched by user
# Returns true if object is watched by user
def watched_by?(user)
!self.watchers.find(:first,
:conditions => ["#{Watcher.table_name}.user_id = ?", user.id]).nil?
!!(user && self.watchers.detect {|w| w.user_id == user.id })
end
# Returns an array of watchers' email addresses