@@ -131,7 +131,12 class WatchersController < ApplicationController | |||||
131 | klass = Object.const_get(params[:object_type].camelcase) rescue nil |
|
131 | klass = Object.const_get(params[:object_type].camelcase) rescue nil | |
132 | return unless klass && klass.respond_to?('watched_by') |
|
132 | return unless klass && klass.respond_to?('watched_by') | |
133 |
|
133 | |||
134 |
|
|
134 | scope = klass.where(:id => Array.wrap(params[:object_id])) | |
|
135 | if klass.reflect_on_association(:project) | |||
|
136 | scope = scope.preload(:project => :enabled_modules) | |||
|
137 | end | |||
|
138 | objects = scope.to_a | |||
|
139 | ||||
135 | raise Unauthorized if objects.any? do |w| |
|
140 | raise Unauthorized if objects.any? do |w| | |
136 | if w.respond_to?(:visible?) |
|
141 | if w.respond_to?(:visible?) | |
137 | !w.visible? |
|
142 | !w.visible? |
General Comments 0
You need to be logged in to leave comments.
Login now