diff options
Diffstat (limited to 'app/controllers/watchers_controller.rb')
-rw-r--r-- | app/controllers/watchers_controller.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb index 488898546..d9f2351d0 100644 --- a/app/controllers/watchers_controller.rb +++ b/app/controllers/watchers_controller.rb @@ -131,7 +131,12 @@ class WatchersController < ApplicationController klass = Object.const_get(params[:object_type].camelcase) rescue nil return unless klass && klass.respond_to?('watched_by') - objects = klass.where(:id => Array.wrap(params[:object_id])).to_a + scope = klass.where(:id => Array.wrap(params[:object_id])) + if klass.reflect_on_association(:project) + scope = scope.preload(:project => :enabled_modules) + end + objects = scope.to_a + raise Unauthorized if objects.any? do |w| if w.respond_to?(:visible?) !w.visible? |