From 1ad33134d3005af9a1c8357a55e8c6ab9332d4fa Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 9 Feb 2014 11:54:21 +0000 Subject: Enable the watching of news (#2549). git-svn-id: http://svn.redmine.org/redmine/trunk@12866 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/watchers_controller.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'app/controllers/watchers_controller.rb') 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 -- cgit v1.2.3