A platform for community discussion. Free, open, simple.
DEV: Compatibility with TruffleRuby (#16864)
Gerhard Schlager0af05c2682fe
diff --git a/app/models/post_action_type.rb b/app/models/post_action_type.rbindex c73e171a1fb..a209a79b6b0 100644--- a/app/models/post_action_type.rb+++ b/app/models/post_action_type.rb@@ -12,51 +12,14 @@ class PostActionType < ActiveRecord::Baseendclass << self-- def flag_settings- unless @flag_settings- @flag_settings = FlagSettings.new- @flag_settings.add(- 3,- :off_topic,- notify_type: true,- auto_action_type: true,- )- @flag_settings.add(- 4,- :inappropriate,- topic_type: true,- notify_type: true,- auto_action_type: true,- )- @flag_settings.add(- 8,- :spam,- topic_type: true,- notify_type: true,- auto_action_type: true,- )- @flag_settings.add(- 6,- :notify_user,- topic_type: false,- notify_type: false,- custom_type: true- )- @flag_settings.add(- 7,- :notify_moderators,- topic_type: true,- notify_type: true,- custom_type: true- )- end-- @flag_settings- end+ attr_reader :flag_settingsdef replace_flag_settings(settings)- @flag_settings = settings+ if settings+ @flag_settings = settings+ else+ initialize_flag_settings+ end@types = nilend@@ -117,7 +80,49 @@ class PostActionType < ActiveRecord::Basedef is_flag?(sym)flag_types.valid?(sym)end++ private++ def initialize_flag_settings+ @flag_settings = FlagSettings.new+ @flag_settings.add(+ 3,+ :off_topic,+ notify_type: true,+ auto_action_type: true,+ )+ @flag_settings.add(+ 4,+ :inappropriate,+ topic_type: true,+ notify_type: true,+ auto_action_type: true,+ )+ @flag_settings.add(+ 8,+ :spam,+ topic_type: true,+ notify_type: true,+ auto_action_type: true,+ )+ @flag_settings.add(+ 6,+ :notify_user,+ topic_type: false,+ notify_type: false,+ custom_type: true+ )+ @flag_settings.add(+ 7,+ :notify_moderators,+ topic_type: true,+ notify_type: true,+ custom_type: true+ )+ endend++ initialize_flag_settingsend# == Schema Informationdiff --git a/lib/flag_settings.rb b/lib/flag_settings.rbindex 7a6b83d73a1..da86d2c1b43 100644--- a/lib/flag_settings.rb+++ b/lib/flag_settings.rb@@ -20,8 +20,6 @@ class FlagSettingsenddef add(id, name, topic_type: nil, notify_type: nil, auto_action_type: nil, custom_type: nil)- details ||= {}-@all_flag_types[name] = id@topic_flag_types[name] = id if !!topic_type@notify_types[name] = id if !!notify_type