mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 11:58:33 +08:00
FEATURE: Conditionally change back button route for thread (#22129)
When clicking back from a thread, we want to either go back to the channel if the thread was opened from an indicator, or to the thread list if we opened it from there. Since ember doesn't give a nice way to get the previous route, we need to store this ourselves. We only do this on mobile, on desktop we just follow existing behaviour. Also implements a chat router history. --------- Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
This commit is contained in:
@ -3,6 +3,10 @@
|
||||
module PageObjects
|
||||
module Pages
|
||||
class ChatSidePanel < PageObjects::Pages::Base
|
||||
def open?
|
||||
has_css?(".chat-side-panel")
|
||||
end
|
||||
|
||||
def has_open_thread?(thread = nil)
|
||||
if thread
|
||||
has_css?(".chat-side-panel .chat-thread[data-id='#{thread.id}']")
|
||||
|
@ -58,17 +58,17 @@ module PageObjects
|
||||
header.find(".chat-thread__close").click
|
||||
end
|
||||
|
||||
def back_to_list
|
||||
header.find(".chat-thread__back-to-list").click
|
||||
def back_to_previous_route
|
||||
header.find(".chat-thread__back-to-previous-route").click
|
||||
end
|
||||
|
||||
def has_no_unread_list_indicator?
|
||||
has_no_css?(".chat-thread__back-to-list .chat-thread-header-unread-indicator")
|
||||
has_no_css?(".chat-thread__back-to-previous-route .chat-thread-header-unread-indicator")
|
||||
end
|
||||
|
||||
def has_unread_list_indicator?(count:)
|
||||
has_css?(
|
||||
".chat-thread__back-to-list .chat-thread-header-unread-indicator .chat-thread-header-unread-indicator__number",
|
||||
".chat-thread__back-to-previous-route .chat-thread-header-unread-indicator .chat-thread-header-unread-indicator__number",
|
||||
text: count.to_s,
|
||||
)
|
||||
end
|
||||
|
@ -15,6 +15,10 @@ module PageObjects
|
||||
component.has_no_css?(".spinner")
|
||||
end
|
||||
|
||||
def open_thread(thread)
|
||||
item_by_id(thread.id).click
|
||||
end
|
||||
|
||||
def has_thread?(thread)
|
||||
item_by_id(thread.id)
|
||||
end
|
||||
|
Reference in New Issue
Block a user