From 21343a16a4d785275341f9b6ca356fd0c43ac16d Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Thu, 14 Mar 2024 13:07:08 +1000 Subject: [PATCH] DEV: Fix include_*? and require_plugin_enabled deprecation warnings (#53) --- plugin.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugin.rb b/plugin.rb index f266858..897439f 100644 --- a/plugin.rb +++ b/plugin.rb @@ -37,17 +37,18 @@ replace_flags(settings: PostActionType.flag_settings, score_type_names: %i[malicious_file]) - add_to_serializer(:site, :clamav_unreacheable, false) do + add_to_serializer( + :site, + :clamav_unreacheable, + respect_plugin_enabled: false, + include_condition: -> { SiteSetting.discourse_antivirus_enabled? && scope.is_staff? }, + ) do !!PluginStore.get( DiscourseAntivirus::ClamAV::PLUGIN_NAME, DiscourseAntivirus::ClamAV::UNAVAILABLE, ) end - add_to_serializer(:site, :include_clamav_unreacheable?, false) do - SiteSetting.discourse_antivirus_enabled? && scope.is_staff? - end - on(:site_setting_changed) do |name, _, new_val| Jobs.enqueue(:fetch_antivirus_version) if name == :discourse_antivirus_enabled && new_val end