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:
Joffrey JAFFEUX
2023-05-24 15:36:46 +02:00
committed by GitHub
parent d4a5b79592
commit 4de1d3952b
17 changed files with 338 additions and 177 deletions

View File

@ -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

View File

@ -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