DEV: move post flags into database (#27125)

This is preparation for a feature that will allow admins to define their custom flags. Current behaviour should stay untouched.
This commit is contained in:
Krzysztof Kotlarek
2024-05-23 12:19:07 +10:00
committed by GitHub
parent 312a930ac8
commit cfbbfd177c
30 changed files with 380 additions and 104 deletions

View File

@@ -7,6 +7,7 @@ class FlagSettings
:topic_flag_types,
:auto_action_types,
:custom_types,
:names,
)
def initialize
@@ -16,18 +17,28 @@ class FlagSettings
@auto_action_types = Enum.new
@custom_types = Enum.new
@without_custom_types = Enum.new
@names = Enum.new
end
def add(id, name, topic_type: nil, notify_type: nil, auto_action_type: nil, custom_type: nil)
@all_flag_types[name] = id
@topic_flag_types[name] = id if !!topic_type
@notify_types[name] = id if !!notify_type
@auto_action_types[name] = id if !!auto_action_type
def add(
id,
name_key,
topic_type: nil,
notify_type: nil,
auto_action_type: nil,
custom_type: nil,
name: nil
)
@all_flag_types[name_key] = id
@topic_flag_types[name_key] = id if !!topic_type
@notify_types[name_key] = id if !!notify_type
@auto_action_types[name_key] = id if !!auto_action_type
@names[id] = name if name
if !!custom_type
@custom_types[name] = id
@custom_types[name_key] = id
else
@without_custom_types[name] = id
@without_custom_types[name_key] = id
end
end