mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 21:59:34 +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:
@ -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)
|
||||
|
@ -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
|
Reference in New Issue
Block a user