1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-02-01 03:57:15 +00:00

Remove unused method addable_watcher_users from acts_as_watchable.rb (#43429).

git-svn-id: https://svn.redmine.org/redmine/trunk@24215 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA 2025-12-18 10:19:49 +00:00
parent 9241496644
commit 43f72bb6f2
2 changed files with 0 additions and 22 deletions

View File

@ -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)

View File

@ -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!}