Return only users who can see the watchable

pull/2264/head
Hagen Schink 10 years ago
parent 65e57e0d8b
commit 18af561064
  1. 4
      app/views/work_packages/_form.html.erb
  2. 6
      lib/plugins/acts_as_watchable/lib/acts_as_watchable.rb

@ -63,8 +63,8 @@ See doc/COPYRIGHT.rdoc for more details.
<hr class="form_separator" />
<div id="watchers_form">
<label class="watcher_label"><%= l(:label_work_package_watchers) %></label>
<% work_package.project.users.sort.each do |user| -%>
<label class="floating"><%= check_box_tag 'work_package[watcher_user_ids][]', user.id, work_package.watched_by?(user) %> <%=h user %></label>
<% work_package.possible_watcher_users.sort.each do |user| -%>
<label class="floating"><%= check_box_tag 'work_package[watcher_user_ids][]', user.id, work_package.watched_by?(user) && work_package.visible?(user) %> <%=h user %></label>
<% end -%>
</div>
<% end %>

@ -89,10 +89,10 @@ module Redmine
# TODO: There might be addable users which are not in the current
# project. But its hard (performance wise) to find them
# correctly. So we only search for users in the project scope.
# Also, the watchable might not be allowed to be seen by all
# users in the project.
# This implementation is so wrong, it makes me sad.
project.users
watchers = project.users
watchers = watchers.select { |w| visible?(w) } if respond_to?(:visible?)
watchers
end
# Returns an array of users that are proposed as watchers

Loading…
Cancel
Save