mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 22:35:03 +08:00
FIX: improves draft for channels (#21724)
This commit attempts to correctly change draft when the channel changes. It moves responsibility to the composer instead of the channel. A new service `chatDraftsManager` is being introduced here to allow finer control and pave the way for future thread draft support. These changes also now allow an editing message to be stored as a draft.
This commit is contained in:
@ -12,6 +12,10 @@ module PageObjects
|
||||
@context = context
|
||||
end
|
||||
|
||||
def message_details
|
||||
@message_details ||= PageObjects::Components::Chat::ComposerMessageDetails.new(context)
|
||||
end
|
||||
|
||||
def input
|
||||
find(context).find(SELECTOR).find(".chat-composer__input")
|
||||
end
|
||||
@ -31,6 +35,10 @@ module PageObjects
|
||||
def open_emoji_picker
|
||||
find(context).find(SELECTOR).find(".chat-composer-button__btn.emoji").click
|
||||
end
|
||||
|
||||
def editing_message?(message)
|
||||
value == message.message && message_details.editing_message?(message)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -12,13 +12,19 @@ module PageObjects
|
||||
@context = context
|
||||
end
|
||||
|
||||
def has_message?(message)
|
||||
find(context).find(SELECTOR + "[data-id=\"#{message.id}\"]")
|
||||
def has_message?(message, action: nil)
|
||||
data_attributes = "[data-id=\"#{message.id}\"]"
|
||||
data_attributes << "[data-action=\"#{action}\"]" if action
|
||||
find(context).find(SELECTOR + data_attributes)
|
||||
end
|
||||
|
||||
def has_no_message?
|
||||
find(context).has_no_css?(SELECTOR)
|
||||
end
|
||||
|
||||
def editing_message?(message)
|
||||
has_message?(message, action: :edit)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user