mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 03:08:23 +08:00
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:
@ -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")
|
||||
|
Reference in New Issue
Block a user