A platform for community discussion. Free, open, simple.
FIX: Reload the ReviewableScore types when extending flags (#8740)
Roman Rizzi28d09227f581
diff --git a/app/models/reviewable_score.rb b/app/models/reviewable_score.rbindex 690090e9a65..13265826c85 100644--- a/app/models/reviewable_score.rb+++ b/app/models/reviewable_score.rb@@ -14,6 +14,13 @@ class ReviewableScore < ActiveRecord::Base)end+ # When extending post action flags, we need to call this method in order to+ # get the latests flags.+ def self.reload_types+ @types = nil+ types+ end+def self.statuses@statuses ||= Enum.new(pending: 0,diff --git a/lib/plugin/instance.rb b/lib/plugin/instance.rbindex 228b1119fb5..9c75950ede3 100644--- a/lib/plugin/instance.rb+++ b/lib/plugin/instance.rb@@ -128,10 +128,13 @@ class Plugin::Instance# Applies to all sites in a multisite environment. Ignores plugin.enabled?def replace_flags(settings: ::FlagSettings.new)- yield settings+ next_flag_id = ReviewableScore.types.values.max + 1++ yield(settings, next_flag_id)reloadable_patch do |plugin|::PostActionType.replace_flag_settings(settings)+ ::ReviewableScore.reload_typesendend