A platform for community discussion. Free, open, simple.
FIX: don't load database flag when database is disabled (#27148)
Krzysztof Kotlarek13848594d271
diff --git a/app/models/post_action_type.rb b/app/models/post_action_type.rbindex 0c596d9055e..2becdad1207 100644--- a/app/models/post_action_type.rb+++ b/app/models/post_action_type.rb@@ -27,7 +27,9 @@ class PostActionType < ActiveRecord::Baseenddef types- return Enum.new(like: 2).merge!(flag_settings.flag_types) if overridden_by_plugin?+ if overridden_by_plugin_or_skipped_db?+ return Enum.new(like: 2).merge!(flag_settings.flag_types)+ endEnum.new(like: 2).merge(flag_types)end@@ -37,8 +39,8 @@ class PostActionType < ActiveRecord::BaseReviewableScore.reload_typesend- def overridden_by_plugin?- flag_settings.flag_types.present?+ def overridden_by_plugin_or_skipped_db?+ flag_settings.flag_types.present? || GlobalSetting.skip_db?enddef all_flags@@ -46,7 +48,7 @@ class PostActionType < ActiveRecord::Baseenddef auto_action_flag_types- return flag_settings.auto_action_types if overridden_by_plugin?+ return flag_settings.auto_action_types if overridden_by_plugin_or_skipped_db?flag_enum(all_flags.select(&:auto_action_type))end@@ -59,12 +61,12 @@ class PostActionType < ActiveRecord::Baseenddef flag_types_without_custom- return flag_settings.without_custom_types if overridden_by_plugin?+ return flag_settings.without_custom_types if overridden_by_plugin_or_skipped_db?flag_enum(all_flags.reject(&:custom_type))enddef flag_types- return flag_settings.flag_types if overridden_by_plugin?+ return flag_settings.flag_types if overridden_by_plugin_or_skipped_db?flag_enum(all_flags)end@@ -74,12 +76,12 @@ class PostActionType < ActiveRecord::Baseenddef notify_flag_types- return flag_settings.notify_types if overridden_by_plugin?+ return flag_settings.notify_types if overridden_by_plugin_or_skipped_db?flag_enum(all_flags.select(&:notify_type))enddef topic_flag_types- if overridden_by_plugin?+ if overridden_by_plugin_or_skipped_db?flag_settings.topic_flag_typeselseflag_enum(all_flags.select { |flag| flag.applies_to?("Topic") })@@ -87,7 +89,7 @@ class PostActionType < ActiveRecord::Baseenddef custom_types- return flag_settings.custom_types if overridden_by_plugin?+ return flag_settings.custom_types if overridden_by_plugin_or_skipped_db?flag_enum(all_flags.select(&:custom_type))end