summaryrefslogtreecommitdiffstats
path: root/app/controllers/watchers_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-02-09 11:54:21 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-02-09 11:54:21 +0000
commit1ad33134d3005af9a1c8357a55e8c6ab9332d4fa (patch)
treed964e26f55acaa8791ab15776de735fc3cfc682b /app/controllers/watchers_controller.rb
parentfa31229a2338706455dd754fd57e7f7e8ebf26a7 (diff)
downloadredmine-1ad33134d3005af9a1c8357a55e8c6ab9332d4fa.tar.gz
redmine-1ad33134d3005af9a1c8357a55e8c6ab9332d4fa.zip
Enable the watching of news (#2549).
git-svn-id: http://svn.redmine.org/redmine/trunk@12866 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/watchers_controller.rb')
-rw-r--r--app/controllers/watchers_controller.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb
index f9de4a030..0096d8ac1 100644
--- a/app/controllers/watchers_controller.rb
+++ b/app/controllers/watchers_controller.rb
@@ -90,7 +90,13 @@ class WatchersController < ApplicationController
klass = Object.const_get(params[:object_type].camelcase) rescue nil
if klass && klass.respond_to?('watched_by')
@watchables = klass.where(:id => Array.wrap(params[:object_id])).all
- raise Unauthorized if @watchables.any? {|w| w.respond_to?(:visible?) && !w.visible?}
+ raise Unauthorized if @watchables.any? {|w|
+ if w.respond_to?(:visible?)
+ !w.visible?
+ elsif w.respond_to?(:project) && w.project
+ !w.project.visible?
+ end
+ }
end
render_404 unless @watchables.present?
end