GitLab steht Mittwoch, den 23. September, zwischen 10:00 und 12:00 Uhr aufgrund von Wartungsarbeiten nicht zur Verfügung.

Commit 75b0bc1c authored by jplang's avatar jplang

Preload project when possible (#5754).

git-svn-id: e93f8b46-1217-0410-a6f0-8f06a7374b81
parent d7b77595
......@@ -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)
objects = scope.to_a
raise Unauthorized if objects.any? do |w|
if w.respond_to?(:visible?)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment