]> source.dussan.org Git - redmine.git/commitdiff
Merged r21235 from trunk to 4.1-stable (#35463).
authorMarius Balteanu <marius.balteanu@zitec.com>
Tue, 5 Oct 2021 19:34:35 +0000 (19:34 +0000)
committerMarius Balteanu <marius.balteanu@zitec.com>
Tue, 5 Oct 2021 19:34:35 +0000 (19:34 +0000)
git-svn-id: http://svn.redmine.org/redmine/branches/4.1-stable@21237 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/watchers_controller.rb

index f0692e31dfeb8771077a63604873ca568e890ba6..023f7e40345a796d98149fddaac826f58fb4f545 100644 (file)
@@ -134,7 +134,9 @@ class WatchersController < ApplicationController
 
   def find_objets_from_params
     klass = Object.const_get(params[:object_type].camelcase) rescue nil
-    return unless klass && klass.respond_to?('watched_by')
+    return unless klass && Class === klass # rubocop:disable Style/CaseEquality
+    return unless klass < ActiveRecord::Base
+    return unless klass < Redmine::Acts::Watchable::InstanceMethods
 
     scope = klass.where(:id => Array.wrap(params[:object_id]))
     if klass.reflect_on_association(:project)