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 `😄`.


![image](https://github.com/user-attachments/assets/8913db0e-d6ec-4347-ad91-2329206b127c)

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:
Joffrey JAFFEUX
2025-04-04 09:15:13 +02:00
committed by GitHub
parent 33748895a9
commit 4c8420833e
16 changed files with 431 additions and 40 deletions

View File

@ -151,6 +151,10 @@ module PageObjects
within(message_reactions_list(message)) { return find("[data-emoji-name=\"#{emoji}\"]") }
end
def find_quick_reaction(emoji_name)
find(".chat-message-actions [data-emoji-name=\"#{emoji_name}\"]")
end
def has_reaction?(message, emoji, text = nil)
within(message_reactions_list(message)) do
has_css?("[data-emoji-name=\"#{emoji}\"]", text: text)

View File

@ -0,0 +1,42 @@
# frozen_string_literal: true
module PageObjects
module Pages
class UserPreferencesChat < PageObjects::Pages::Base
def visit
page.visit("/my/preferences/chat")
self
end
def emoji_picker_triggers
all(".emoji-picker-trigger", visible: true)
end
def reaction_buttons
all(".emoji-pickers button")
end
def reactions_selected
reaction_buttons.map { |b| b.find("img")[:title] }
end
def select_option_value(selector, value)
select_kit = PageObjects::Components::SelectKit.new(selector)
select_kit.expand
select_kit.select_row_by_value(value)
end
def selected_option_value(selector)
PageObjects::Components::SelectKit.new(selector).value
end
def save_changes_and_refresh
page.find(".save-changes").click
# reloading the page happens in JS on save but capybara doesnt wait for it
# which can mess up navigating away too soon in tests
# so doing a manual refresh here to mimic
page.refresh
end
end
end
end