diff --git a/lib/plugins/acts_as_watchable/lib/acts_as_watchable.rb b/lib/plugins/acts_as_watchable/lib/acts_as_watchable.rb index c8ba2d199..e8f4dd32f 100644 --- a/lib/plugins/acts_as_watchable/lib/acts_as_watchable.rb +++ b/lib/plugins/acts_as_watchable/lib/acts_as_watchable.rb @@ -51,15 +51,6 @@ module Redmine base.extend ClassMethods end - # Returns an array of users that are proposed as watchers - def addable_watcher_users - users = self.project.principals.assignable_watchers.sort - self.watcher_users - if respond_to?(:visible?) - users.reject! {|user| user.is_a?(User) && !visible?(user)} - end - users - end - # array of watchers that the given user is allowed to see def visible_watcher_users(user = User.current) if user.allowed_to?(:"view_#{self.class.name.underscore}_watchers", project) diff --git a/test/unit/watcher_test.rb b/test/unit/watcher_test.rb index 1fd853f31..a63810c57 100644 --- a/test/unit/watcher_test.rb +++ b/test/unit/watcher_test.rb @@ -110,14 +110,6 @@ class WatcherTest < ActiveSupport::TestCase assert_equal 2, issue.watchers.count end - def test_addable_watcher_users - addable_watcher_users = @issue.addable_watcher_users - assert_kind_of Array, addable_watcher_users - addable_watcher_users.each do |addable_watcher| - assert_equal true, addable_watcher.is_a?(User) || addable_watcher.is_a?(Group) - end - end - def test_add_watcher_with_unsaved_object issue = Issue.new(project: Project.find(1), tracker_id: 1, subject: "test", author: User.find(2)) assert_not issue.persisted? @@ -155,11 +147,6 @@ class WatcherTest < ActiveSupport::TestCase assert 0, Watcher.where(watchable: issue).count end - def test_addable_watcher_users_should_not_include_user_that_cannot_view_the_object - issue = Issue.new(:project => Project.find(1), :is_private => true) - assert_nil issue.addable_watcher_users.detect {|user| user.is_a?(User) && !issue.visible?(user)} - end - def test_any_watched_should_return_false_if_no_object_is_watched objects = (0..2).map {Issue.generate!}