##// END OF EJS Templates
Make use of #watched_by? in issue form....
Jean-Philippe Lang -
r3000:e5dc94fe82cb
parent child
Show More
@@ -23,7 +23,7
23 <% if @issue.new_record? && User.current.allowed_to?(:add_issue_watchers, @project) -%>
23 <% if @issue.new_record? && User.current.allowed_to?(:add_issue_watchers, @project) -%>
24 <p><label><%= l(:label_issue_watchers) %></label>
24 <p><label><%= l(:label_issue_watchers) %></label>
25 <% @issue.project.users.sort.each do |user| -%>
25 <% @issue.project.users.sort.each do |user| -%>
26 <label class="floating"><%= check_box_tag 'issue[watcher_user_ids][]', user.id, @issue.watcher_user_ids.include?(user.id) %> <%=h user %></label>
26 <label class="floating"><%= check_box_tag 'issue[watcher_user_ids][]', user.id, @issue.watched_by?(user) %> <%=h user %></label>
27 <% end -%>
27 <% end -%>
28 </p>
28 </p>
29 <% end %>
29 <% end %>
@@ -46,10 +46,9 module Redmine
46 watching ? add_watcher(user) : remove_watcher(user)
46 watching ? add_watcher(user) : remove_watcher(user)
47 end
47 end
48
48
49 # Returns if object is watched by user
49 # Returns true if object is watched by user
50 def watched_by?(user)
50 def watched_by?(user)
51 !self.watchers.find(:first,
51 !!(user && self.watchers.detect {|w| w.user_id == user.id })
52 :conditions => ["#{Watcher.table_name}.user_id = ?", user.id]).nil?
53 end
52 end
54
53
55 # Returns an array of watchers' email addresses
54 # Returns an array of watchers' email addresses
General Comments 0
You need to be logged in to leave comments. Login now