mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 04:31:10 +08:00
DEV: Move settings to linkify to the serializer code. (#14553)
We aren't translating these settings, so it makes more sense to move them into the code. I added an instance method so plugins can add mappings for custom reasons.
This commit is contained in:
@ -950,6 +950,26 @@ class Plugin::Instance
|
||||
DiscoursePluginRegistry.register_presence_channel_prefix([prefix, block], self)
|
||||
end
|
||||
|
||||
# Register a ReviewableScore setting_name associated with a reason.
|
||||
# We'll use this to build a site setting link and add it to the reason's translation.
|
||||
#
|
||||
# If your plugin has a reason translation looking like this:
|
||||
#
|
||||
# my_plugin_reason: "This is the reason this post was flagged. See %{link}."
|
||||
#
|
||||
# And you associate the reason with a setting:
|
||||
#
|
||||
# add_reviewable_score_link(:my_plugin_reason, 'a_plugin_setting')
|
||||
#
|
||||
# We'll generate the following link and attach it to the translation:
|
||||
#
|
||||
# <a href="/admin/site_settings/category/all_results?filter=a_plugin_setting">
|
||||
# a plugin setting
|
||||
# </a>
|
||||
def add_reviewable_score_link(reason, setting_name)
|
||||
DiscoursePluginRegistry.register_reviewable_score_link({ reason: reason.to_sym, setting: setting_name }, self)
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def self.js_path
|
||||
|
Reference in New Issue
Block a user