From 92100f82ebed11a3bc53f63b65408e9c92179004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Tue, 20 Nov 2018 17:28:41 +0100 Subject: [PATCH] FIX: properly disable serializable attributes when poll plugin is disabled --- plugins/poll/plugin.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/poll/plugin.rb b/plugins/poll/plugin.rb index fd3070b4fb3..001fd7d16a5 100644 --- a/plugins/poll/plugin.rb +++ b/plugins/poll/plugin.rb @@ -474,7 +474,7 @@ after_initialize do end add_to_serializer(:post, :include_polls?) do - preloaded_polls.present? + SiteSetting.poll_enabled && preloaded_polls.present? end add_to_serializer(:post, :polls_votes, false) do @@ -490,6 +490,7 @@ after_initialize do end add_to_serializer(:post, :include_polls_votes?) do + SiteSetting.poll_enabled && scope.user&.id.present? && preloaded_polls.present? && preloaded_polls.any? { |p| p.has_voted?(scope.user) }