FEATURE: Create a link to start a new chat (#25722)

This feature adds the functionality to start a new chat directly from the URL using query params.

The format is: /chat/new-message?recipients=buford,jona

The initial version of this feature allows for the following:

- Open an existing direct message channel with a single user
- Create a new direct message channel with a single user (and auto redirect)
- Create or open a channel with multiple users (and auto redirect)
- Redirects to chat home if the recipients param is missing
This commit is contained in:
David Battersby
2024-02-20 18:08:57 +08:00
committed by GitHub
parent d8d756cd2f
commit a460dbcb37
6 changed files with 85 additions and 0 deletions

View File

@ -91,6 +91,16 @@ module PageObjects
PageObjects::Pages::ChatBrowse.new.has_finished_loading?
end
def visit_new_message(recipients)
if recipients.is_a?(Array)
recipients = recipients.map(&:username).join(",")
elsif recipients.respond_to?(:username)
recipients = recipients.username
end
visit("/chat/new-message?recipients=#{recipients}")
end
def has_finished_loading?
has_no_css?(".chat-channel--not-loaded-once")
has_no_css?(".chat-skeleton")