Introduces @valid_watcher?@ check on watchables (@40946).

Patch by Jens Krämer (@jkraemer).



git-svn-id: https://svn.redmine.org/redmine/trunk@22916 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Marius Balteanu
2024-07-08 21:33:50 +00:00
parent 57743c4145
commit c15c754589
3 changed files with 17 additions and 8 deletions

View File

@@ -70,6 +70,14 @@ module Redmine
end
end
# true if user can be added as a watcher
def valid_watcher?(user)
return true unless respond_to?(:visible?)
return true unless user.is_a?(User)
visible?(user)
end
# Adds user as a watcher
def add_watcher(user)
if persisted?