Merge pull request #1878 from opf/fix/watcher_list_performance

Restore wrong (but performant) possible_watcher impl
pull/1863/merge
Alex Coles 10 years ago
commit 0834d8ae61
  1. 7
      app/models/work_package.rb
  2. 14
      lib/plugins/acts_as_watchable/lib/acts_as_watchable.rb

@ -702,13 +702,6 @@ class WorkPackage < ActiveRecord::Base
work_package
end
# Override of acts_as_watchable#possible_watcher_users
# Restricts the result to project members for private as well as public projects
def possible_watcher_users
users = project.users
users.select {|user| possible_watcher?(user)}
end
# check if user is allowed to edit WorkPackage Journals.
# see Redmine::Acts::Journalized::Permissions#journal_editable_by
def editable_by?(user)

@ -86,13 +86,13 @@ module Redmine
end
def possible_watcher_users
User.not_builtin.tap do |users|
if respond_to?(:visible?)
users.select! {|user| possible_watcher?(user)}
else
warn watching_permitted_to_all_users_message
end
end
# 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
end
# Returns an array of users that are proposed as watchers

Loading…
Cancel
Save