From 4158136f18a25c6b7372cb5345ec29911c52e1b1 Mon Sep 17 00:00:00 2001 From: Marius Balteanu Date: Tue, 5 Oct 2021 19:32:36 +0000 Subject: [PATCH] Merged r21235 from trunk to 4.2-stable (#35463). git-svn-id: http://svn.redmine.org/redmine/branches/4.2-stable@21236 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/watchers_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb index 61681b894..79b809516 100644 --- a/app/controllers/watchers_controller.rb +++ b/app/controllers/watchers_controller.rb @@ -158,7 +158,9 @@ class WatchersController < ApplicationController rescue nil end - 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) -- 2.39.5