2021-09-08 00:36:05 +08:00
|
|
|
{
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
|
|
|
"default_archetype": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"notification_types": {
|
|
|
|
"type": "object",
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
|
|
|
"mentioned": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"replied": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"quoted": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"edited": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"liked": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"private_message": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"invited_to_private_message": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"invitee_accepted": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"posted": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
2022-12-14 07:22:26 +08:00
|
|
|
"watching_category_or_tag": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
2022-12-16 01:12:53 +08:00
|
|
|
"new_features": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
2023-05-04 00:35:22 +08:00
|
|
|
"admin_problems": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
2021-09-08 00:36:05 +08:00
|
|
|
"moved_post": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"linked": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"granted_badge": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"invited_to_topic": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"custom": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"group_mentioned": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"group_message_summary": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"watching_first_post": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"topic_reminder": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"liked_consolidated": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
2024-04-10 01:53:37 +08:00
|
|
|
"linked_consolidated": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
2021-09-08 00:36:05 +08:00
|
|
|
"post_approved": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"code_review_commit_approved": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"membership_request_accepted": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"membership_request_consolidated": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"bookmark_reminder": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"reaction": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"votes_released": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"event_reminder": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"event_invitation": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"chat_mention": {
|
|
|
|
"type": "integer"
|
2021-09-14 22:57:38 +08:00
|
|
|
},
|
|
|
|
"chat_message": {
|
|
|
|
"type": "integer"
|
2021-12-14 23:01:53 +08:00
|
|
|
},
|
|
|
|
"chat_invitation": {
|
|
|
|
"type": "integer"
|
2022-01-18 22:26:27 +08:00
|
|
|
},
|
|
|
|
"chat_group_mention": {
|
|
|
|
"type": "integer"
|
2022-02-16 13:22:08 +08:00
|
|
|
},
|
|
|
|
"chat_quoted": {
|
|
|
|
"type": "integer"
|
2022-03-17 04:08:10 +08:00
|
|
|
},
|
2024-09-02 20:45:55 +08:00
|
|
|
"chat_watched_thread": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
2022-03-17 04:08:10 +08:00
|
|
|
"assigned": {
|
|
|
|
"type": "integer"
|
2022-03-28 16:03:19 +08:00
|
|
|
},
|
|
|
|
"question_answer_user_commented": {
|
|
|
|
"type": "integer"
|
2022-12-19 12:57:35 +08:00
|
|
|
},
|
|
|
|
"following": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"following_created_topic": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"following_replied": {
|
|
|
|
"type": "integer"
|
2023-01-13 01:07:42 +08:00
|
|
|
},
|
|
|
|
"circles_activity": {
|
|
|
|
"type": "integer"
|
2021-09-08 00:36:05 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": [
|
|
|
|
"mentioned",
|
|
|
|
"replied",
|
|
|
|
"quoted",
|
|
|
|
"edited",
|
|
|
|
"liked",
|
|
|
|
"private_message",
|
|
|
|
"invited_to_private_message",
|
|
|
|
"invitee_accepted",
|
|
|
|
"posted",
|
2022-12-14 07:22:26 +08:00
|
|
|
"watching_category_or_tag",
|
2021-09-08 00:36:05 +08:00
|
|
|
"moved_post",
|
|
|
|
"linked",
|
|
|
|
"granted_badge",
|
|
|
|
"invited_to_topic",
|
|
|
|
"custom",
|
|
|
|
"group_mentioned",
|
|
|
|
"group_message_summary",
|
|
|
|
"watching_first_post",
|
|
|
|
"topic_reminder",
|
|
|
|
"liked_consolidated",
|
2024-04-10 01:53:37 +08:00
|
|
|
"linked_consolidated",
|
2021-09-08 00:36:05 +08:00
|
|
|
"post_approved",
|
|
|
|
"code_review_commit_approved",
|
|
|
|
"membership_request_accepted",
|
|
|
|
"membership_request_consolidated",
|
|
|
|
"bookmark_reminder",
|
|
|
|
"reaction",
|
|
|
|
"votes_released",
|
|
|
|
"event_reminder",
|
|
|
|
"event_invitation",
|
2022-01-18 22:26:27 +08:00
|
|
|
"chat_mention",
|
|
|
|
"chat_message",
|
|
|
|
"chat_invitation",
|
|
|
|
"chat_group_mention"
|
2021-09-08 00:36:05 +08:00
|
|
|
]
|
|
|
|
},
|
|
|
|
"post_types": {
|
|
|
|
"type": "object",
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
|
|
|
"regular": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"moderator_action": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"small_action": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"whisper": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": [
|
|
|
|
"regular",
|
|
|
|
"moderator_action",
|
|
|
|
"small_action",
|
|
|
|
"whisper"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"trust_levels": {
|
|
|
|
"type": "object",
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
|
|
|
"newuser": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"basic": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"member": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"regular": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"leader": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": [
|
|
|
|
"newuser",
|
|
|
|
"basic",
|
|
|
|
"member",
|
|
|
|
"regular",
|
|
|
|
"leader"
|
|
|
|
]
|
|
|
|
},
|
2023-05-09 01:33:08 +08:00
|
|
|
"user_tips": {
|
|
|
|
"type": "object",
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
|
|
|
"first_notification": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"topic_timeline": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"post_menu": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"topic_notification_levels": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"suggested_topics": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": [
|
|
|
|
"first_notification",
|
|
|
|
"topic_timeline",
|
|
|
|
"post_menu",
|
|
|
|
"topic_notification_levels",
|
2024-04-23 08:04:15 +08:00
|
|
|
"suggested_topics"
|
2023-05-09 01:33:08 +08:00
|
|
|
]
|
|
|
|
},
|
2021-09-08 00:36:05 +08:00
|
|
|
"groups": {
|
|
|
|
"type": "array",
|
2022-06-21 00:56:56 +08:00
|
|
|
"items":
|
2021-09-08 00:36:05 +08:00
|
|
|
{
|
|
|
|
"type": "object",
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
|
|
|
"id": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"flair_url": {
|
|
|
|
"type": [
|
|
|
|
"string",
|
|
|
|
"null"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"flair_bg_color": {
|
|
|
|
"type": [
|
|
|
|
"string",
|
|
|
|
"null"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"flair_color": {
|
|
|
|
"type": [
|
|
|
|
"string",
|
|
|
|
"null"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": [
|
|
|
|
"id",
|
|
|
|
"name",
|
|
|
|
"flair_url",
|
|
|
|
"flair_bg_color",
|
|
|
|
"flair_color"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"filters": {
|
|
|
|
"type": "array",
|
2022-06-21 00:56:56 +08:00
|
|
|
"items": {
|
2021-09-08 00:36:05 +08:00
|
|
|
|
2022-06-21 00:56:56 +08:00
|
|
|
}
|
2021-09-08 00:36:05 +08:00
|
|
|
},
|
|
|
|
"periods": {
|
|
|
|
"type": "array",
|
2022-06-21 00:56:56 +08:00
|
|
|
"items": {
|
2021-09-08 00:36:05 +08:00
|
|
|
|
2022-06-21 00:56:56 +08:00
|
|
|
}
|
2021-09-08 00:36:05 +08:00
|
|
|
},
|
|
|
|
"top_menu_items": {
|
|
|
|
"type": "array",
|
2022-06-21 00:56:56 +08:00
|
|
|
"items": {
|
2021-09-08 00:36:05 +08:00
|
|
|
|
2022-06-21 00:56:56 +08:00
|
|
|
}
|
2021-09-08 00:36:05 +08:00
|
|
|
},
|
|
|
|
"anonymous_top_menu_items": {
|
|
|
|
"type": "array",
|
2022-06-21 00:56:56 +08:00
|
|
|
"items": {
|
2021-09-08 00:36:05 +08:00
|
|
|
|
2022-06-21 00:56:56 +08:00
|
|
|
}
|
2021-09-08 00:36:05 +08:00
|
|
|
},
|
|
|
|
"uncategorized_category_id": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"user_field_max_length": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"post_action_types": {
|
|
|
|
"type": "array",
|
2022-06-21 00:56:56 +08:00
|
|
|
"items":
|
2021-09-08 00:36:05 +08:00
|
|
|
{
|
|
|
|
"type": "object",
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
|
|
|
"id": {
|
2022-06-21 00:56:56 +08:00
|
|
|
"type": ["integer", "null"]
|
2021-09-08 00:36:05 +08:00
|
|
|
},
|
|
|
|
"name_key": {
|
2022-06-21 00:56:56 +08:00
|
|
|
"type": ["string", "null"]
|
2021-09-08 00:36:05 +08:00
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"description": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"short_description": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"is_flag": {
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
2024-07-18 08:10:22 +08:00
|
|
|
"require_message": {
|
2021-09-08 00:36:05 +08:00
|
|
|
"type": "boolean"
|
2024-05-29 12:39:58 +08:00
|
|
|
},
|
|
|
|
"enabled": {
|
|
|
|
"type": "boolean"
|
2024-07-03 06:45:37 +08:00
|
|
|
},
|
|
|
|
"applies_to": {
|
|
|
|
"type": "array"
|
|
|
|
},
|
|
|
|
"is_used": {
|
|
|
|
"type": "boolean"
|
FIX: serialize Flags instead of PostActionType (#28362)
### Why?
Before, all flags were static. Therefore, they were stored in class variables and serialized by SiteSerializer. Recently, we added an option for admins to add their own flags or disable existing flags. Therefore, the class variable had to be dropped because it was unsafe for a multisite environment. However, it started causing performance problems.
### Solution
When a new Flag system is used, instead of using PostActionType, we can serialize Flags and use fragment cache for performance reasons.
At the same time, we are still supporting deprecated `replace_flags` API call. When it is used, we fall back to the old solution and the admin cannot add custom flags. In a couple of months, we will be able to drop that API function and clean that code properly. However, because it may still be used, redis cache was introduced to improve performance.
To test backward compatibility you can add this code to any plugin
```ruby
replace_flags do |flag_settings|
flag_settings.add(
4,
:inappropriate,
topic_type: true,
notify_type: true,
auto_action_type: true,
)
flag_settings.add(1001, :trolling, topic_type: true, notify_type: true, auto_action_type: true)
end
```
2024-08-14 10:13:46 +08:00
|
|
|
},
|
|
|
|
"position": {
|
|
|
|
"type": "integer"
|
2024-10-22 07:56:31 +08:00
|
|
|
},
|
|
|
|
"auto_action_type": {
|
|
|
|
"type": "boolean"
|
2021-09-08 00:36:05 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": [
|
|
|
|
"id",
|
|
|
|
"name_key",
|
|
|
|
"name",
|
|
|
|
"description",
|
|
|
|
"short_description",
|
|
|
|
"is_flag",
|
2024-07-18 08:10:22 +08:00
|
|
|
"require_message",
|
2024-07-03 06:45:37 +08:00
|
|
|
"enabled",
|
|
|
|
"applies_to",
|
2024-10-22 07:56:31 +08:00
|
|
|
"is_used",
|
|
|
|
"auto_action_type"
|
2021-09-08 00:36:05 +08:00
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"topic_flag_types": {
|
|
|
|
"type": "array",
|
2022-06-21 00:56:56 +08:00
|
|
|
"items":
|
2021-09-08 00:36:05 +08:00
|
|
|
{
|
|
|
|
"type": "object",
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
|
|
|
"id": {
|
2022-06-21 00:56:56 +08:00
|
|
|
"type": ["integer", "null"]
|
2021-09-08 00:36:05 +08:00
|
|
|
},
|
|
|
|
"name_key": {
|
2022-06-21 00:56:56 +08:00
|
|
|
"type": ["string", "null"]
|
2021-09-08 00:36:05 +08:00
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"description": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"short_description": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"is_flag": {
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
2024-07-18 08:10:22 +08:00
|
|
|
"require_message": {
|
2021-09-08 00:36:05 +08:00
|
|
|
"type": "boolean"
|
2024-05-29 12:39:58 +08:00
|
|
|
},
|
|
|
|
"enabled": {
|
|
|
|
"type": "boolean"
|
2024-07-03 06:45:37 +08:00
|
|
|
},
|
|
|
|
"applies_to": {
|
|
|
|
"type": "array"
|
|
|
|
},
|
|
|
|
"is_used": {
|
|
|
|
"type": "boolean"
|
FIX: serialize Flags instead of PostActionType (#28362)
### Why?
Before, all flags were static. Therefore, they were stored in class variables and serialized by SiteSerializer. Recently, we added an option for admins to add their own flags or disable existing flags. Therefore, the class variable had to be dropped because it was unsafe for a multisite environment. However, it started causing performance problems.
### Solution
When a new Flag system is used, instead of using PostActionType, we can serialize Flags and use fragment cache for performance reasons.
At the same time, we are still supporting deprecated `replace_flags` API call. When it is used, we fall back to the old solution and the admin cannot add custom flags. In a couple of months, we will be able to drop that API function and clean that code properly. However, because it may still be used, redis cache was introduced to improve performance.
To test backward compatibility you can add this code to any plugin
```ruby
replace_flags do |flag_settings|
flag_settings.add(
4,
:inappropriate,
topic_type: true,
notify_type: true,
auto_action_type: true,
)
flag_settings.add(1001, :trolling, topic_type: true, notify_type: true, auto_action_type: true)
end
```
2024-08-14 10:13:46 +08:00
|
|
|
},
|
|
|
|
"position": {
|
|
|
|
"type": "integer"
|
2024-10-22 07:56:31 +08:00
|
|
|
},
|
|
|
|
"auto_action_type": {
|
|
|
|
"type": "boolean"
|
2021-09-08 00:36:05 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": [
|
|
|
|
"id",
|
|
|
|
"name_key",
|
|
|
|
"name",
|
|
|
|
"description",
|
|
|
|
"short_description",
|
|
|
|
"is_flag",
|
2024-07-18 08:10:22 +08:00
|
|
|
"require_message",
|
2024-07-03 06:45:37 +08:00
|
|
|
"enabled",
|
|
|
|
"applies_to",
|
2024-10-22 07:56:31 +08:00
|
|
|
"is_used",
|
|
|
|
"auto_action_type"
|
2021-09-08 00:36:05 +08:00
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"can_create_tag": {
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
|
|
|
"can_tag_topics": {
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
|
|
|
"can_tag_pms": {
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
|
|
|
"tags_filter_regexp": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"top_tags": {
|
|
|
|
"type": "array",
|
2022-06-21 00:56:56 +08:00
|
|
|
"items": {
|
2021-09-08 00:36:05 +08:00
|
|
|
|
2022-06-21 00:56:56 +08:00
|
|
|
}
|
2021-09-08 00:36:05 +08:00
|
|
|
},
|
|
|
|
"wizard_required": {
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
2021-12-09 20:30:27 +08:00
|
|
|
"can_associate_groups": {
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
2021-09-08 00:36:05 +08:00
|
|
|
"topic_featured_link_allowed_category_ids": {
|
|
|
|
"type": "array",
|
2022-06-21 00:56:56 +08:00
|
|
|
"items": {
|
2021-09-08 00:36:05 +08:00
|
|
|
|
2022-06-21 00:56:56 +08:00
|
|
|
}
|
2021-09-08 00:36:05 +08:00
|
|
|
},
|
|
|
|
"user_themes": {
|
|
|
|
"type": "array",
|
2022-06-21 00:56:56 +08:00
|
|
|
"items":
|
2021-09-08 00:36:05 +08:00
|
|
|
{
|
|
|
|
"type": "object",
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
|
|
|
"theme_id": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"default": {
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
|
|
|
"color_scheme_id": {
|
|
|
|
"type": [
|
2021-09-16 08:03:08 +08:00
|
|
|
"integer",
|
2021-09-08 00:36:05 +08:00
|
|
|
"null"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": [
|
|
|
|
"theme_id",
|
|
|
|
"name",
|
|
|
|
"default",
|
|
|
|
"color_scheme_id"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"user_color_schemes": {
|
|
|
|
"type": "array",
|
2022-06-21 00:56:56 +08:00
|
|
|
"items":
|
2021-09-08 00:36:05 +08:00
|
|
|
{
|
|
|
|
"type": "object",
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
|
|
|
"id": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"is_dark": {
|
|
|
|
"type": "boolean"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": [
|
|
|
|
"id",
|
|
|
|
"name",
|
|
|
|
"is_dark"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"default_dark_color_scheme": {
|
|
|
|
"type": [
|
|
|
|
"object",
|
|
|
|
"null"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"censored_regexp": {
|
2022-08-02 16:06:03 +08:00
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "object"
|
|
|
|
}
|
2021-09-08 00:36:05 +08:00
|
|
|
},
|
|
|
|
"custom_emoji_translation": {
|
|
|
|
"type": "object",
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
2022-06-21 00:56:56 +08:00
|
|
|
}
|
2021-09-08 00:36:05 +08:00
|
|
|
},
|
|
|
|
"watched_words_replace": {
|
|
|
|
"type": [
|
|
|
|
"string",
|
|
|
|
"null"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"watched_words_link": {
|
|
|
|
"type": [
|
|
|
|
"string",
|
|
|
|
"null"
|
|
|
|
]
|
|
|
|
},
|
2022-01-28 11:02:02 +08:00
|
|
|
"markdown_additional_options" : {
|
|
|
|
"type": "object"
|
|
|
|
},
|
FEATURE: Generic hashtag autocomplete lookup and markdown cooking (#18937)
This commit fleshes out and adds functionality for the new `#hashtag` search and
lookup system, still hidden behind the `enable_experimental_hashtag_autocomplete`
feature flag.
**Serverside**
We have two plugin API registration methods that are used to define data sources
(`register_hashtag_data_source`) and hashtag result type priorities depending on
the context (`register_hashtag_type_in_context`). Reading the comments in plugin.rb
should make it clear what these are doing. Reading the `HashtagAutocompleteService`
in full will likely help a lot as well.
Each data source is responsible for providing its own **lookup** and **search**
method that returns hashtag results based on the arguments provided. For example,
the category hashtag data source has to take into account parent categories and
how they relate, and each data source has to define their own icon to use for the
hashtag, and so on.
The `Site` serializer has two new attributes that source data from `HashtagAutocompleteService`.
There is `hashtag_icons` that is just a simple array of all the different icons that
can be used for allowlisting in our markdown pipeline, and there is `hashtag_context_configurations`
that is used to store the type priority orders for each registered context.
When sending emails, we cannot render the SVG icons for hashtags, so
we need to change the HTML hashtags to the normal `#hashtag` text.
**Markdown**
The `hashtag-autocomplete.js` file is where I have added the new `hashtag-autocomplete`
markdown rule, and like all of our rules this is used to cook the raw text on both the clientside
and on the serverside using MiniRacer. Only on the server side do we actually reach out to
the database with the `hashtagLookup` function, on the clientside we just render a plainer
version of the hashtag HTML. Only in the composer preview do we do further lookups based
on this.
This rule is the first one (that I can find) that uses the `currentUser` based on a passed
in `user_id` for guardian checks in markdown rendering code. This is the `last_editor_id`
for both the post and chat message. In some cases we need to cook without a user present,
so the `Discourse.system_user` is used in this case.
**Chat Channels**
This also contains the changes required for chat so that chat channels can be used
as a data source for hashtag searches and lookups. This data source will only be
used when `enable_experimental_hashtag_autocomplete` is `true`, so we don't have
to worry about channel results suddenly turning up.
------
**Known Rough Edges**
- Onebox excerpts will not render the icon svg/use tags, I plan to address that in a follow up PR
- Selecting a hashtag + pressing the Quote button will result in weird behaviour, I plan to address that in a follow up PR
- Mixed hashtag contexts for hashtags without a type suffix will not work correctly, e.g. #ux which is both a category and a channel slug will resolve to a category when used inside a post or within a [chat] transcript in that post. Users can get around this manually by adding the correct suffix, for example ::channel. We may get to this at some point in future
- Icons will not show for the hashtags in emails since SVG support is so terrible in email (this is not likely to be resolved, but still noting for posterity)
- Additional refinements and review fixes wil
2022-11-21 06:37:06 +08:00
|
|
|
"hashtag_configurations" : {
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"hashtag_icons" : {
|
2023-05-23 15:33:55 +08:00
|
|
|
"type": "object"
|
FEATURE: Generic hashtag autocomplete lookup and markdown cooking (#18937)
This commit fleshes out and adds functionality for the new `#hashtag` search and
lookup system, still hidden behind the `enable_experimental_hashtag_autocomplete`
feature flag.
**Serverside**
We have two plugin API registration methods that are used to define data sources
(`register_hashtag_data_source`) and hashtag result type priorities depending on
the context (`register_hashtag_type_in_context`). Reading the comments in plugin.rb
should make it clear what these are doing. Reading the `HashtagAutocompleteService`
in full will likely help a lot as well.
Each data source is responsible for providing its own **lookup** and **search**
method that returns hashtag results based on the arguments provided. For example,
the category hashtag data source has to take into account parent categories and
how they relate, and each data source has to define their own icon to use for the
hashtag, and so on.
The `Site` serializer has two new attributes that source data from `HashtagAutocompleteService`.
There is `hashtag_icons` that is just a simple array of all the different icons that
can be used for allowlisting in our markdown pipeline, and there is `hashtag_context_configurations`
that is used to store the type priority orders for each registered context.
When sending emails, we cannot render the SVG icons for hashtags, so
we need to change the HTML hashtags to the normal `#hashtag` text.
**Markdown**
The `hashtag-autocomplete.js` file is where I have added the new `hashtag-autocomplete`
markdown rule, and like all of our rules this is used to cook the raw text on both the clientside
and on the serverside using MiniRacer. Only on the server side do we actually reach out to
the database with the `hashtagLookup` function, on the clientside we just render a plainer
version of the hashtag HTML. Only in the composer preview do we do further lookups based
on this.
This rule is the first one (that I can find) that uses the `currentUser` based on a passed
in `user_id` for guardian checks in markdown rendering code. This is the `last_editor_id`
for both the post and chat message. In some cases we need to cook without a user present,
so the `Discourse.system_user` is used in this case.
**Chat Channels**
This also contains the changes required for chat so that chat channels can be used
as a data source for hashtag searches and lookups. This data source will only be
used when `enable_experimental_hashtag_autocomplete` is `true`, so we don't have
to worry about channel results suddenly turning up.
------
**Known Rough Edges**
- Onebox excerpts will not render the icon svg/use tags, I plan to address that in a follow up PR
- Selecting a hashtag + pressing the Quote button will result in weird behaviour, I plan to address that in a follow up PR
- Mixed hashtag contexts for hashtags without a type suffix will not work correctly, e.g. #ux which is both a category and a channel slug will resolve to a category when used inside a post or within a [chat] transcript in that post. Users can get around this manually by adding the correct suffix, for example ::channel. We may get to this at some point in future
- Icons will not show for the hashtags in emails since SVG support is so terrible in email (this is not likely to be resolved, but still noting for posterity)
- Additional refinements and review fixes wil
2022-11-21 06:37:06 +08:00
|
|
|
},
|
FEATURE: Add plugin API to register About stat group (#17442)
This commit introduces a new plugin API to register
a group of stats that will be included in about.json
and also conditionally in the site about UI at /about.
The usage is like this:
```ruby
register_about_stat_group("chat_messages", show_in_ui: true) do
{
last_day: 1,
"7_days" => 10,
"30_days" => 100,
count: 1000,
previous_30_days: 120
}
end
```
In reality the stats will be generated any way the implementer
chooses within the plugin. The `last_day`, `7_days`, `30_days,` and `count`
keys must be present but apart from that additional stats may be added.
Only those core 4 stat keys will be shown in the UI, but everything will be shown
in about.json.
The stat group name is used to prefix the stats in about.json like so:
```json
"chat_messages_last_day": 2322,
"chat_messages_7_days": 2322,
"chat_messages_30_days": 2322,
"chat_messages_count": 2322,
```
The `show_in_ui` option (default false) is used to determine whether the
group of stats is shown on the site About page in the Site Statistics
table. Some stats may be needed purely for reporting purposes and thus
do not need to be shown in the UI to admins/users. An extension to the Site
serializer, `displayed_about_plugin_stat_groups`, has been added so this
can be inspected on the client-side.
2022-07-15 11:16:00 +08:00
|
|
|
"displayed_about_plugin_stat_groups" : {
|
|
|
|
"type": "array"
|
|
|
|
},
|
2021-09-08 00:36:05 +08:00
|
|
|
"categories": {
|
|
|
|
"type": "array",
|
2022-06-21 00:56:56 +08:00
|
|
|
"items":
|
2021-09-08 00:36:05 +08:00
|
|
|
{
|
|
|
|
"type": "object",
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
|
|
|
"id": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"color": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"text_color": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"slug": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"topic_count": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"post_count": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"position": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"description": {
|
2022-06-21 02:33:33 +08:00
|
|
|
"type": [
|
|
|
|
"string",
|
|
|
|
"null"
|
|
|
|
]
|
2021-09-08 00:36:05 +08:00
|
|
|
},
|
|
|
|
"description_text": {
|
2022-06-21 02:33:33 +08:00
|
|
|
"type": [
|
|
|
|
"string",
|
|
|
|
"null"
|
|
|
|
]
|
2021-09-08 00:36:05 +08:00
|
|
|
},
|
|
|
|
"description_excerpt": {
|
2022-06-21 02:33:33 +08:00
|
|
|
"type": [
|
|
|
|
"string",
|
|
|
|
"null"
|
|
|
|
]
|
2021-09-08 00:36:05 +08:00
|
|
|
},
|
|
|
|
"topic_url": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"read_restricted": {
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
|
|
|
"permission": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"notification_level": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"topic_template": {
|
|
|
|
"type": [
|
|
|
|
"string",
|
|
|
|
"null"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"has_children": {
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
2024-04-25 21:47:45 +08:00
|
|
|
"subcategory_count": {
|
|
|
|
"type": [
|
|
|
|
"integer",
|
|
|
|
"null"
|
|
|
|
]
|
|
|
|
},
|
2021-09-08 00:36:05 +08:00
|
|
|
"sort_order": {
|
|
|
|
"type": [
|
|
|
|
"string",
|
|
|
|
"null"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"sort_ascending": {
|
|
|
|
"type": [
|
|
|
|
"string",
|
|
|
|
"null"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"show_subcategory_list": {
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
|
|
|
"num_featured_topics": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"default_view": {
|
|
|
|
"type": [
|
|
|
|
"string",
|
|
|
|
"null"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"subcategory_list_style": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"default_top_period": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"default_list_filter": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"minimum_required_tags": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"navigate_to_first_post_after_read": {
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
|
|
|
"allowed_tags": {
|
|
|
|
"type": "array",
|
2022-06-21 00:56:56 +08:00
|
|
|
"items": {
|
2021-09-08 00:36:05 +08:00
|
|
|
|
2022-06-21 00:56:56 +08:00
|
|
|
}
|
2021-09-08 00:36:05 +08:00
|
|
|
},
|
|
|
|
"allowed_tag_groups": {
|
|
|
|
"type": "array",
|
2022-06-21 00:56:56 +08:00
|
|
|
"items": {
|
2021-09-08 00:36:05 +08:00
|
|
|
|
2022-06-21 00:56:56 +08:00
|
|
|
}
|
2021-09-08 00:36:05 +08:00
|
|
|
},
|
|
|
|
"allow_global_tags": {
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
2022-04-06 21:08:06 +08:00
|
|
|
"required_tag_groups": {
|
|
|
|
"type": "array",
|
2022-06-21 00:56:56 +08:00
|
|
|
"items":
|
2022-04-06 21:08:06 +08:00
|
|
|
{
|
|
|
|
"type": "object",
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
|
|
|
"name": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"min_count": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": [
|
|
|
|
"name",
|
|
|
|
"min_count"
|
|
|
|
]
|
|
|
|
}
|
2021-09-08 00:36:05 +08:00
|
|
|
},
|
|
|
|
"read_only_banner": {
|
|
|
|
"type": [
|
|
|
|
"string",
|
|
|
|
"null"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"uploaded_logo": {
|
|
|
|
"type": [
|
|
|
|
"string",
|
|
|
|
"null"
|
|
|
|
]
|
|
|
|
},
|
2022-10-07 23:00:44 +08:00
|
|
|
"uploaded_logo_dark": {
|
|
|
|
"type": [
|
|
|
|
"string",
|
|
|
|
"null"
|
|
|
|
]
|
|
|
|
},
|
2021-09-08 00:36:05 +08:00
|
|
|
"uploaded_background": {
|
|
|
|
"type": [
|
|
|
|
"string",
|
|
|
|
"null"
|
|
|
|
]
|
|
|
|
},
|
2023-10-20 20:48:06 +08:00
|
|
|
"uploaded_background_dark": {
|
|
|
|
"type": [
|
|
|
|
"string",
|
|
|
|
"null"
|
|
|
|
]
|
|
|
|
},
|
2021-09-08 00:36:05 +08:00
|
|
|
"can_edit": {
|
|
|
|
"type": "boolean"
|
2022-07-08 09:04:50 +08:00
|
|
|
},
|
|
|
|
"custom_fields": {
|
|
|
|
"type": [
|
|
|
|
"object",
|
|
|
|
"null"
|
|
|
|
],
|
|
|
|
"additionalProperties": true
|
|
|
|
},
|
|
|
|
"parent_category_id": {
|
|
|
|
"type": "integer"
|
2023-03-01 01:09:20 +08:00
|
|
|
},
|
|
|
|
"form_template_ids": {
|
|
|
|
"type": "array",
|
2023-06-24 01:06:45 +08:00
|
|
|
"items": {}
|
2021-09-08 00:36:05 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": [
|
|
|
|
"id",
|
|
|
|
"name",
|
|
|
|
"color",
|
|
|
|
"text_color",
|
|
|
|
"slug",
|
|
|
|
"topic_count",
|
|
|
|
"post_count",
|
|
|
|
"position",
|
|
|
|
"topic_url",
|
|
|
|
"read_restricted",
|
|
|
|
"permission",
|
|
|
|
"notification_level",
|
|
|
|
"topic_template",
|
|
|
|
"has_children",
|
2024-04-25 21:47:45 +08:00
|
|
|
"subcategory_count",
|
2021-09-08 00:36:05 +08:00
|
|
|
"sort_order",
|
|
|
|
"sort_ascending",
|
|
|
|
"show_subcategory_list",
|
|
|
|
"num_featured_topics",
|
|
|
|
"default_view",
|
|
|
|
"subcategory_list_style",
|
|
|
|
"default_top_period",
|
|
|
|
"default_list_filter",
|
|
|
|
"minimum_required_tags",
|
|
|
|
"navigate_to_first_post_after_read",
|
|
|
|
"allowed_tags",
|
|
|
|
"allowed_tag_groups",
|
|
|
|
"allow_global_tags",
|
2022-04-06 21:08:06 +08:00
|
|
|
"required_tag_groups",
|
2021-09-08 00:36:05 +08:00
|
|
|
"read_only_banner",
|
|
|
|
"uploaded_logo",
|
2022-10-07 23:00:44 +08:00
|
|
|
"uploaded_logo_dark",
|
2021-09-08 00:36:05 +08:00
|
|
|
"uploaded_background",
|
2023-10-20 20:48:06 +08:00
|
|
|
"uploaded_background_dark",
|
2021-09-08 00:36:05 +08:00
|
|
|
"can_edit"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"archetypes": {
|
|
|
|
"type": "array",
|
2022-06-21 00:56:56 +08:00
|
|
|
"items":
|
2021-09-08 00:36:05 +08:00
|
|
|
{
|
|
|
|
"type": "object",
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
|
|
|
"id": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"options": {
|
|
|
|
"type": "array",
|
2022-06-21 00:56:56 +08:00
|
|
|
"items": {
|
2021-09-08 00:36:05 +08:00
|
|
|
|
2022-06-21 00:56:56 +08:00
|
|
|
}
|
2021-09-08 00:36:05 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": [
|
|
|
|
"id",
|
|
|
|
"name",
|
|
|
|
"options"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"user_fields": {
|
|
|
|
"type": "array",
|
2022-06-21 00:56:56 +08:00
|
|
|
"items": {
|
2021-09-08 00:36:05 +08:00
|
|
|
|
2022-06-21 00:56:56 +08:00
|
|
|
}
|
2021-09-08 00:36:05 +08:00
|
|
|
},
|
|
|
|
"auth_providers": {
|
|
|
|
"type": "array",
|
2022-06-21 00:56:56 +08:00
|
|
|
"items": {
|
2021-09-08 00:36:05 +08:00
|
|
|
|
2022-06-21 00:56:56 +08:00
|
|
|
}
|
2022-12-24 02:42:46 +08:00
|
|
|
},
|
|
|
|
"whispers_allowed_groups_names" : {
|
|
|
|
"type": "array"
|
2023-04-13 15:38:54 +08:00
|
|
|
},
|
|
|
|
"denied_emojis" : {
|
|
|
|
"type": "array"
|
2023-07-24 08:07:37 +08:00
|
|
|
},
|
2024-07-03 06:45:37 +08:00
|
|
|
"valid_flag_applies_to_types" : {
|
|
|
|
"type": "array"
|
|
|
|
},
|
2023-07-24 08:07:37 +08:00
|
|
|
"navigation_menu_site_top_tags": {
|
|
|
|
"type": "array"
|
2021-09-08 00:36:05 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": [
|
|
|
|
"default_archetype",
|
|
|
|
"notification_types",
|
|
|
|
"post_types",
|
|
|
|
"trust_levels",
|
|
|
|
"groups",
|
|
|
|
"filters",
|
|
|
|
"periods",
|
|
|
|
"top_menu_items",
|
|
|
|
"anonymous_top_menu_items",
|
|
|
|
"uncategorized_category_id",
|
|
|
|
"user_field_max_length",
|
|
|
|
"post_action_types",
|
|
|
|
"topic_flag_types",
|
|
|
|
"can_create_tag",
|
|
|
|
"can_tag_topics",
|
|
|
|
"can_tag_pms",
|
|
|
|
"tags_filter_regexp",
|
|
|
|
"top_tags",
|
|
|
|
"topic_featured_link_allowed_category_ids",
|
|
|
|
"user_themes",
|
|
|
|
"user_color_schemes",
|
|
|
|
"default_dark_color_scheme",
|
|
|
|
"censored_regexp",
|
|
|
|
"custom_emoji_translation",
|
|
|
|
"watched_words_replace",
|
|
|
|
"watched_words_link",
|
|
|
|
"categories",
|
|
|
|
"archetypes",
|
|
|
|
"user_fields",
|
|
|
|
"auth_providers"
|
|
|
|
]
|
|
|
|
}
|