mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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:
committed by
GitHub
parent
312a930ac8
commit
cfbbfd177c
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user