Skip to content

Commit

Permalink
DEV: Fix include_*? and require_plugin_enabled deprecation warnings (#53
Browse files Browse the repository at this point in the history
)
  • Loading branch information
martin-brennan authored Mar 14, 2024
1 parent 416c2c5 commit 21343a1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 21343a1

Please sign in to comment.