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:
parent
7592a955fb
commit
e5dc94fe82
|
@ -23,7 +23,7 @@
|
|||
<% if @issue.new_record? && User.current.allowed_to?(:add_issue_watchers, @project) -%>
|
||||
<p><label><%= l(:label_issue_watchers) %></label>
|
||||
<% @issue.project.users.sort.each do |user| -%>
|
||||
<label class="floating"><%= check_box_tag 'issue[watcher_user_ids][]', user.id, @issue.watcher_user_ids.include?(user.id) %> <%=h user %></label>
|
||||
<label class="floating"><%= check_box_tag 'issue[watcher_user_ids][]', user.id, @issue.watched_by?(user) %> <%=h user %></label>
|
||||
<% end -%>
|
||||
</p>
|
||||
<% end %>
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue