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:
Martin Brennan
2023-06-28 09:58:47 +10:00
committed by GitHub
parent aef7c2fe8f
commit cec68b3e2c
15 changed files with 144 additions and 37 deletions

View File

@ -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}']")

View File

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

View File

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