mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 10:11:25 +08:00
FEATURE: One-click chat reaction settings (#32150)
Adds a one-click chat reactions setting to the chat preferences page where members can determine what one-click reactions are shown in chat. - Frequent: This will be the default setting. (Automatically set based on most used chat reactions) - Custom: Members can choose up to three reactions they want to see in their one-click chat/DM reactions menu. Defaults are `❤️`, `👍` , and `😄`.  This pull request is essentially the work of @dsims in https://github.com/discourse/discourse/pull/31761 --------- Co-authored-by: dsims <1041068+dsims@users.noreply.github.com>
This commit is contained in:
@ -54,6 +54,8 @@ after_initialize do
|
||||
DiscoursePluginRegistry.register_flag_applies_to_type("Chat::Message", self)
|
||||
|
||||
UserUpdater::OPTION_ATTR.push(:chat_enabled)
|
||||
UserUpdater::OPTION_ATTR.push(:chat_quick_reaction_type)
|
||||
UserUpdater::OPTION_ATTR.push(:chat_quick_reactions_custom)
|
||||
UserUpdater::OPTION_ATTR.push(:only_chat_push_notifications)
|
||||
UserUpdater::OPTION_ATTR.push(:chat_sound)
|
||||
UserUpdater::OPTION_ATTR.push(:ignore_channel_wide_mention)
|
||||
@ -251,6 +253,18 @@ after_initialize do
|
||||
|
||||
add_to_serializer(:current_user_option, :chat_send_shortcut) { object.chat_send_shortcut }
|
||||
|
||||
add_to_serializer(:user_option, :chat_quick_reaction_type) { object.chat_quick_reaction_type }
|
||||
add_to_serializer(:current_user_option, :chat_quick_reaction_type) do
|
||||
object.chat_quick_reaction_type
|
||||
end
|
||||
|
||||
add_to_serializer(:user_option, :chat_quick_reactions_custom) do
|
||||
object.chat_quick_reactions_custom
|
||||
end
|
||||
add_to_serializer(:current_user_option, :chat_quick_reactions_custom) do
|
||||
object.chat_quick_reactions_custom
|
||||
end
|
||||
|
||||
on(:site_setting_changed) do |name, old_value, new_value|
|
||||
user_option_field = Chat::RETENTION_SETTINGS_TO_USER_OPTION_FIELDS[name.to_sym]
|
||||
begin
|
||||
|
Reference in New Issue
Block a user