2023-02-14 09:38:41 +08:00
|
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2023-06-07 09:26:58 +08:00
|
|
|
|
describe "Single thread in side panel", type: :system do
|
2023-02-14 09:38:41 +08:00
|
|
|
|
fab!(:current_user) { Fabricate(:user) }
|
|
|
|
|
|
|
|
|
|
let(:chat_page) { PageObjects::Pages::Chat.new }
|
|
|
|
|
let(:channel_page) { PageObjects::Pages::ChatChannel.new }
|
|
|
|
|
let(:side_panel) { PageObjects::Pages::ChatSidePanel.new }
|
2023-04-27 02:37:58 +08:00
|
|
|
|
let(:thread_page) { PageObjects::Pages::ChatThread.new }
|
DEV: Refactoring chat message actions for ChatMessage component usage in thread panel (#20756)
This commit is a major overhaul of how chat message actions work, to make it so they are reusable between the main chat channel and the chat thread panel, as well as many improvements and fixes for the thread panel.
There are now several new classes and concepts:
* ChatMessageInteractor - This is initialized from the ChatMessage, ChatMessageActionsDesktop, and ChatMessageActionsMobile components. This handles permissions about what actions can be done for each
message based on the context (thread or channel), handles the actions themselves (e.g. copyLink, delete, edit),
and interacts with the pane of the current context to modify the UI
* ChatChannelThreadPane and ChatChannelPane services - This represents the UI context which contains the
messages, and are mostly used for state management for things like message selection.
* ChatChannelThreadComposer and ChatChannelComposer - This handles interaction between the pane, the
message actions, and the composer, dealing with reply and edit message state.
* Scrolling logic for the messages has now been moved to a helper so it can be shared between the main channel pane and the thread pane
* Various improvements with the emoji picker on both mobile and desktop. The DOM node of each component is now located outside of the message which prevents a large range of issues.
The thread panel now also works in the chat drawer, and the thread messages have less
actions than the main panel, since some do not make sense there (e.g. moving messages to
a different channel). The thread panel title, excerpt, and message sender have also been removed
for now to save space.
This gives us a solid base to keep expanding on and fixing up threads. Subsequent PRs will
make the thread MessageBus subscriptions work and disable echo mode
for the initial release of threads.
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2023-04-06 21:19:52 +08:00
|
|
|
|
let(:chat_drawer_page) { PageObjects::Pages::ChatDrawer.new }
|
2023-04-27 02:37:58 +08:00
|
|
|
|
let(:sidebar_page) { PageObjects::Pages::Sidebar.new }
|
2023-02-14 09:38:41 +08:00
|
|
|
|
|
|
|
|
|
before do
|
|
|
|
|
chat_system_bootstrap(current_user, [channel])
|
|
|
|
|
sign_in(current_user)
|
|
|
|
|
end
|
|
|
|
|
|
2024-02-02 01:27:38 +08:00
|
|
|
|
context "when threading is disabled for the channel" do
|
2023-02-14 09:38:41 +08:00
|
|
|
|
fab!(:channel) { Fabricate(:chat_channel) }
|
2023-08-24 21:22:51 +08:00
|
|
|
|
|
2023-07-26 18:46:23 +08:00
|
|
|
|
before { channel.update!(threading_enabled: false) }
|
2023-02-14 09:38:41 +08:00
|
|
|
|
|
DEV: Do not process requests initiated by browser in a different example (#25809)
Why this change?
We noticed that running `LOAD_PLUGINS=1 rspec --seed=38855 plugins/chat/spec/system/chat_new_message_spec.rb` locally
results in the system tests randomly failing. When we inspected the
request logs closely, we noticed that a `/presence/get` request from a
previous rspec example was being processed when a new rspec example is
already being run. We know it was from the previous rspec example
because inspecting the auth token showed the request using the auth
token of a user from the previous example. However, when a request using
an auth token from a previous example is used it ends up logging out the
same user on the server side because the user id in the cookie is the same
due to the use of `fab!`.
I did some research and there is apparently no way to wait until all
inflight requests by the browser has completed through capybara or
selenium. Therefore, we will add an identifier by attaching a cookie to all non-xhr requests so that
xhr requests which are triggered subsequently will contain the cookie in the request.
In the `BlockRequestsMiddleware` middleware, we will then reject any
requests when the value of the identifier in the cookie does not match the current rspec's example
location.
To see the problem locally, change `Auth::DefaultCurrentUserProvider.find_v1_auth_cookie` to the following:
```
def self.find_v1_auth_cookie(env)
return env[DECRYPTED_AUTH_COOKIE] if env.key?(DECRYPTED_AUTH_COOKIE)
env[DECRYPTED_AUTH_COOKIE] = begin
request = ActionDispatch::Request.new(env)
cookie = request.cookies[TOKEN_COOKIE]
# don't even initialize a cookie jar if we don't have a cookie at all
if cookie&.valid_encoding? && cookie.present?
puts "#{env["REQUEST_PATH"]} #{request.cookie_jar.encrypted[TOKEN_COOKIE]&.with_indifferent_access}"
request.cookie_jar.encrypted[TOKEN_COOKIE]&.with_indifferent_access
end
end
end
```
After which run the following command: `LOAD_PLUGINS=1 rspec --format documentation --seed=38855 plugins/chat/spec/system/chat_new_message_spec.rb`
It takes a few tries but the last spec should fail and you should see something like this:
```
assets/chunk.c16f6ba8b6824baa47ac.d41d8cd9.js {"token"=>"37d995a4b65395d3b343ec70fff915b4", "user_id"=>3382, "username"=>"bruce0", "trust_level"=>1, "issued_at"=>1708591735}
/assets/chunk.050148142e1d2dc992dd.d41d8cd9.js {"token"=>"37d995a4b65395d3b343ec70fff915b4", "user_id"=>3382, "username"=>"bruce0", "trust_level"=>1, "issued_at"=>1708591735}
/chat/api/channels/527/messages {"token"=>"37d995a4b65395d3b343ec70fff915b4", "user_id"=>3382, "username"=>"bruce0", "trust_level"=>1, "issued_at"=>1708591735}
/uploads/default/test_0/optimized/1X/_129430568242d1b7f853bb13ebea28b3f6af4e7_2_512x512.png {"token"=>"37d995a4b65395d3b343ec70fff915b4", "user_id"=>3382, "username"=>"bruce0", "trust_level"=>1, "issued_at"=>1708591735}
redirects to existing chat channel
redirects to chat channel if recipients param is missing (PENDING: Temporarily skipped with xit)
with multiple users
/favicon.ico {"token"=>"9a75c114c4d3401509a23d240f0a46d4", "user_id"=>3382, "username"=>"bruce0", "trust_level"=>1, "issued_at"=>1708591736}
/chat/new-message {"token"=>"9a75c114c4d3401509a23d240f0a46d4", "user_id"=>3382, "username"=>"bruce0", "trust_level"=>1, "issued_at"=>1708591736}
/presence/get {"token"=>"37d995a4b65395d3b343ec70fff915b4", "user_id"=>3382, "username"=>"bruce0", "trust_level"=>1, "issued_at"=>1708591735}
```
Note how the `/presence/get` request is using a token from the previous example.
Co-authored-by: David Taylor <david@taylorhq.com>
2024-02-22 19:41:10 +08:00
|
|
|
|
it "does not open the side panel for a single thread" do
|
2023-02-14 09:38:41 +08:00
|
|
|
|
thread =
|
|
|
|
|
chat_thread_chain_bootstrap(channel: channel, users: [current_user, Fabricate(:user)])
|
|
|
|
|
chat_page.visit_channel(channel)
|
|
|
|
|
channel_page.hover_message(thread.original_message)
|
|
|
|
|
expect(page).not_to have_css(".chat-message-thread-btn")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2023-07-26 18:46:23 +08:00
|
|
|
|
context "when threading is enabled for the channel" do
|
2023-02-14 09:38:41 +08:00
|
|
|
|
fab!(:user_2) { Fabricate(:user) }
|
|
|
|
|
fab!(:channel) { Fabricate(:chat_channel, threading_enabled: true) }
|
|
|
|
|
fab!(:thread) { chat_thread_chain_bootstrap(channel: channel, users: [current_user, user_2]) }
|
|
|
|
|
|
2024-04-25 16:47:54 +08:00
|
|
|
|
context "when returning to a thread where last read is not last message" do
|
|
|
|
|
it "scrolls to the correct last read message" do
|
|
|
|
|
message_1 = Fabricate(:chat_message, thread: thread, chat_channel: channel)
|
|
|
|
|
thread.membership_for(current_user).update!(last_read_message: message_1)
|
|
|
|
|
messages = Fabricate.times(50, :chat_message, thread: thread, chat_channel: channel)
|
|
|
|
|
chat_page.visit_thread(thread)
|
|
|
|
|
|
|
|
|
|
expect(page).to have_css("[data-id='#{message_1.id}'].-highlighted")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2023-04-27 02:37:58 +08:00
|
|
|
|
context "when in full page" do
|
|
|
|
|
context "when switching channel" do
|
|
|
|
|
fab!(:channel_2) { Fabricate(:chat_channel, threading_enabled: true) }
|
|
|
|
|
|
|
|
|
|
before { channel_2.add(current_user) }
|
|
|
|
|
|
|
|
|
|
it "closes the opened thread" do
|
|
|
|
|
chat_page.visit_thread(thread)
|
|
|
|
|
expect(side_panel).to have_open_thread(thread)
|
|
|
|
|
|
|
|
|
|
sidebar_page.open_channel(channel_2)
|
|
|
|
|
|
|
|
|
|
expect(side_panel).to have_no_open_thread
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context "when closing the thread" do
|
|
|
|
|
it "closes it" do
|
|
|
|
|
chat_page.visit_thread(thread)
|
|
|
|
|
expect(side_panel).to have_open_thread(thread)
|
|
|
|
|
|
|
|
|
|
thread_page.close
|
|
|
|
|
|
|
|
|
|
expect(side_panel).to have_no_open_thread
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2023-04-12 09:09:06 +08:00
|
|
|
|
it "opens the single thread in the drawer using the indicator" do
|
DEV: Refactoring chat message actions for ChatMessage component usage in thread panel (#20756)
This commit is a major overhaul of how chat message actions work, to make it so they are reusable between the main chat channel and the chat thread panel, as well as many improvements and fixes for the thread panel.
There are now several new classes and concepts:
* ChatMessageInteractor - This is initialized from the ChatMessage, ChatMessageActionsDesktop, and ChatMessageActionsMobile components. This handles permissions about what actions can be done for each
message based on the context (thread or channel), handles the actions themselves (e.g. copyLink, delete, edit),
and interacts with the pane of the current context to modify the UI
* ChatChannelThreadPane and ChatChannelPane services - This represents the UI context which contains the
messages, and are mostly used for state management for things like message selection.
* ChatChannelThreadComposer and ChatChannelComposer - This handles interaction between the pane, the
message actions, and the composer, dealing with reply and edit message state.
* Scrolling logic for the messages has now been moved to a helper so it can be shared between the main channel pane and the thread pane
* Various improvements with the emoji picker on both mobile and desktop. The DOM node of each component is now located outside of the message which prevents a large range of issues.
The thread panel now also works in the chat drawer, and the thread messages have less
actions than the main panel, since some do not make sense there (e.g. moving messages to
a different channel). The thread panel title, excerpt, and message sender have also been removed
for now to save space.
This gives us a solid base to keep expanding on and fixing up threads. Subsequent PRs will
make the thread MessageBus subscriptions work and disable echo mode
for the initial release of threads.
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2023-04-06 21:19:52 +08:00
|
|
|
|
visit("/latest")
|
|
|
|
|
chat_page.open_from_header
|
|
|
|
|
chat_drawer_page.open_channel(channel)
|
2023-04-12 09:09:06 +08:00
|
|
|
|
channel_page.message_thread_indicator(thread.original_message).click
|
DEV: Refactoring chat message actions for ChatMessage component usage in thread panel (#20756)
This commit is a major overhaul of how chat message actions work, to make it so they are reusable between the main chat channel and the chat thread panel, as well as many improvements and fixes for the thread panel.
There are now several new classes and concepts:
* ChatMessageInteractor - This is initialized from the ChatMessage, ChatMessageActionsDesktop, and ChatMessageActionsMobile components. This handles permissions about what actions can be done for each
message based on the context (thread or channel), handles the actions themselves (e.g. copyLink, delete, edit),
and interacts with the pane of the current context to modify the UI
* ChatChannelThreadPane and ChatChannelPane services - This represents the UI context which contains the
messages, and are mostly used for state management for things like message selection.
* ChatChannelThreadComposer and ChatChannelComposer - This handles interaction between the pane, the
message actions, and the composer, dealing with reply and edit message state.
* Scrolling logic for the messages has now been moved to a helper so it can be shared between the main channel pane and the thread pane
* Various improvements with the emoji picker on both mobile and desktop. The DOM node of each component is now located outside of the message which prevents a large range of issues.
The thread panel now also works in the chat drawer, and the thread messages have less
actions than the main panel, since some do not make sense there (e.g. moving messages to
a different channel). The thread panel title, excerpt, and message sender have also been removed
for now to save space.
This gives us a solid base to keep expanding on and fixing up threads. Subsequent PRs will
make the thread MessageBus subscriptions work and disable echo mode
for the initial release of threads.
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2023-04-06 21:19:52 +08:00
|
|
|
|
expect(chat_drawer_page).to have_open_thread(thread)
|
|
|
|
|
end
|
|
|
|
|
|
2023-04-13 16:08:12 +08:00
|
|
|
|
it "navigates back to the channel when clicking back button from a thread" do
|
|
|
|
|
visit("/latest")
|
|
|
|
|
chat_page.open_from_header
|
|
|
|
|
chat_drawer_page.open_channel(channel)
|
|
|
|
|
channel_page.message_thread_indicator(thread.original_message).click
|
|
|
|
|
expect(chat_drawer_page).to have_open_thread(thread)
|
|
|
|
|
|
|
|
|
|
chat_drawer_page.back
|
|
|
|
|
|
|
|
|
|
expect(chat_drawer_page).to have_open_channel(channel)
|
|
|
|
|
end
|
|
|
|
|
|
2024-03-06 19:03:42 +08:00
|
|
|
|
context "when thread is forced and threading disabled" do
|
|
|
|
|
before do
|
|
|
|
|
channel.update!(threading_enabled: false)
|
|
|
|
|
thread.update!(force: true)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "doesn’t show back button " do
|
|
|
|
|
chat_page.visit_thread(thread)
|
|
|
|
|
|
2024-07-16 18:34:37 +08:00
|
|
|
|
expect(page).to have_no_css(".c-routes.--channel-thread .c-navbar__back-button")
|
2024-03-06 19:03:42 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2024-05-23 03:03:40 +08:00
|
|
|
|
context "when in drawer" do
|
|
|
|
|
it "opens the channel and highlights the message when clicking original message link" do
|
|
|
|
|
visit("/latest")
|
|
|
|
|
chat_page.open_from_header
|
|
|
|
|
chat_drawer_page.open_channel(channel)
|
|
|
|
|
channel_page.message_thread_indicator(thread.original_message).click
|
|
|
|
|
find(".chat-message-info__original-message").click
|
|
|
|
|
|
|
|
|
|
expect(chat_drawer_page).to have_open_channel(channel)
|
|
|
|
|
expect(channel_page.messages).to have_message(
|
|
|
|
|
id: thread.original_message.id,
|
|
|
|
|
highlighted: true,
|
|
|
|
|
)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2024-02-02 01:27:38 +08:00
|
|
|
|
it "highlights the message in the channel when clicking original message link" do
|
|
|
|
|
chat_page.visit_thread(thread)
|
|
|
|
|
|
|
|
|
|
find(".chat-message-info__original-message").click
|
|
|
|
|
|
|
|
|
|
expect(channel_page.messages).to have_message(
|
|
|
|
|
id: thread.original_message.id,
|
|
|
|
|
highlighted: true,
|
|
|
|
|
)
|
|
|
|
|
end
|
|
|
|
|
|
2023-04-12 09:09:06 +08:00
|
|
|
|
it "opens the side panel for a single thread from the indicator" do
|
2023-02-14 09:38:41 +08:00
|
|
|
|
chat_page.visit_channel(channel)
|
2023-04-12 09:09:06 +08:00
|
|
|
|
channel_page.message_thread_indicator(thread.original_message).click
|
2023-02-14 09:38:41 +08:00
|
|
|
|
expect(side_panel).to have_open_thread(thread)
|
|
|
|
|
end
|
|
|
|
|
|
2023-04-13 20:45:50 +08:00
|
|
|
|
describe "sending a message" do
|
|
|
|
|
it "shows the message in the thread pane and links it to the correct channel" do
|
|
|
|
|
chat_page.visit_channel(channel)
|
|
|
|
|
channel_page.message_thread_indicator(thread.original_message).click
|
|
|
|
|
expect(side_panel).to have_open_thread(thread)
|
2023-05-05 14:55:55 +08:00
|
|
|
|
thread_page.send_message("new thread message")
|
2023-08-21 22:31:58 +08:00
|
|
|
|
expect(thread_page.messages).to have_message(
|
|
|
|
|
thread_id: thread.id,
|
|
|
|
|
text: "new thread message",
|
|
|
|
|
)
|
2023-07-13 08:28:11 +08:00
|
|
|
|
thread_message = thread.last_message
|
2023-04-13 20:45:50 +08:00
|
|
|
|
expect(thread_message.chat_channel_id).to eq(channel.id)
|
|
|
|
|
expect(thread_message.thread.channel_id).to eq(channel.id)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "does not echo the message in the channel pane" do
|
|
|
|
|
chat_page.visit_channel(channel)
|
|
|
|
|
channel_page.message_thread_indicator(thread.original_message).click
|
|
|
|
|
expect(side_panel).to have_open_thread(thread)
|
2023-05-05 14:55:55 +08:00
|
|
|
|
thread_page.send_message("new thread message")
|
2023-08-21 22:31:58 +08:00
|
|
|
|
expect(thread_page.messages).to have_message(
|
|
|
|
|
thread_id: thread.id,
|
|
|
|
|
text: "new thread message",
|
|
|
|
|
)
|
2023-04-13 20:45:50 +08:00
|
|
|
|
thread_message = thread.reload.replies.last
|
|
|
|
|
expect(channel_page).not_to have_css(channel_page.message_by_id_selector(thread_message.id))
|
|
|
|
|
end
|
|
|
|
|
|
2023-07-07 11:09:06 +08:00
|
|
|
|
it "changes the tracking bell to be Tracking level in the thread panel" do
|
2023-08-24 21:22:51 +08:00
|
|
|
|
new_thread = Fabricate(:chat_thread, channel: channel, with_replies: 1, use_service: true)
|
2023-07-07 11:09:06 +08:00
|
|
|
|
chat_page.visit_channel(channel)
|
|
|
|
|
channel_page.message_thread_indicator(new_thread.original_message).click
|
|
|
|
|
expect(side_panel).to have_open_thread(new_thread)
|
|
|
|
|
expect(thread_page).to have_notification_level("normal")
|
|
|
|
|
thread_page.send_message("new thread message")
|
|
|
|
|
expect(thread_page).to have_notification_level("tracking")
|
|
|
|
|
end
|
|
|
|
|
|
2023-04-13 20:45:50 +08:00
|
|
|
|
it "handles updates from multiple users sending messages in the thread" do
|
|
|
|
|
using_session(:tab_1) do
|
|
|
|
|
sign_in(current_user)
|
|
|
|
|
chat_page.visit_channel(channel)
|
|
|
|
|
channel_page.message_thread_indicator(thread.original_message).click
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
other_user = Fabricate(:user)
|
|
|
|
|
chat_system_user_bootstrap(user: other_user, channel: channel)
|
2023-07-19 08:21:31 +08:00
|
|
|
|
sign_in(other_user)
|
|
|
|
|
chat_page.visit_channel(channel)
|
|
|
|
|
channel_page.message_thread_indicator(thread.original_message).click
|
2023-04-13 20:45:50 +08:00
|
|
|
|
|
2023-07-19 08:21:31 +08:00
|
|
|
|
expect(side_panel).to have_open_thread(thread)
|
|
|
|
|
|
|
|
|
|
thread_page.send_message("the other user message")
|
2023-04-13 20:45:50 +08:00
|
|
|
|
|
2023-08-21 22:31:58 +08:00
|
|
|
|
expect(thread_page.messages).to have_message(
|
|
|
|
|
thread_id: thread.id,
|
|
|
|
|
text: "the other user message",
|
|
|
|
|
)
|
2023-07-19 08:21:31 +08:00
|
|
|
|
|
|
|
|
|
using_session(:tab_1) do
|
2023-04-13 20:45:50 +08:00
|
|
|
|
expect(side_panel).to have_open_thread(thread)
|
2023-08-21 22:31:58 +08:00
|
|
|
|
expect(thread_page.messages).to have_message(
|
|
|
|
|
thread_id: thread.id,
|
|
|
|
|
text: "the other user message",
|
|
|
|
|
)
|
2023-07-19 08:21:31 +08:00
|
|
|
|
|
2023-05-05 14:55:55 +08:00
|
|
|
|
thread_page.send_message("this is a test message")
|
2023-04-13 20:45:50 +08:00
|
|
|
|
|
2023-08-21 22:31:58 +08:00
|
|
|
|
expect(thread_page.messages).to have_message(
|
|
|
|
|
thread_id: thread.id,
|
|
|
|
|
text: "this is a test message",
|
|
|
|
|
)
|
2023-04-13 20:45:50 +08:00
|
|
|
|
end
|
2023-07-19 08:21:31 +08:00
|
|
|
|
|
2023-08-21 22:31:58 +08:00
|
|
|
|
expect(thread_page.messages).to have_message(
|
|
|
|
|
thread_id: thread.id,
|
|
|
|
|
text: "this is a test message",
|
|
|
|
|
)
|
2023-04-13 20:45:50 +08:00
|
|
|
|
end
|
2023-04-19 06:53:51 +08:00
|
|
|
|
|
|
|
|
|
it "does not mark the channel unread if another user sends a message in the thread" do
|
|
|
|
|
other_user = Fabricate(:user)
|
|
|
|
|
chat_system_user_bootstrap(user: other_user, channel: channel)
|
2023-08-24 21:22:51 +08:00
|
|
|
|
Fabricate(
|
|
|
|
|
:chat_message,
|
|
|
|
|
thread: thread,
|
2023-04-19 06:53:51 +08:00
|
|
|
|
user: other_user,
|
2023-08-24 21:22:51 +08:00
|
|
|
|
message: "Hello world!",
|
|
|
|
|
use_service: true,
|
2023-04-19 06:53:51 +08:00
|
|
|
|
)
|
|
|
|
|
sign_in(current_user)
|
|
|
|
|
chat_page.visit_channel(channel)
|
|
|
|
|
expect(page).not_to have_css(
|
|
|
|
|
".sidebar-section-link.channel-#{channel.id} .sidebar-section-link-suffix.unread",
|
|
|
|
|
)
|
|
|
|
|
end
|
2023-04-13 20:45:50 +08:00
|
|
|
|
end
|
|
|
|
|
|
2023-02-14 09:38:41 +08:00
|
|
|
|
context "when using mobile" do
|
2023-04-12 09:09:06 +08:00
|
|
|
|
it "opens the side panel for a single thread using the indicator", mobile: true do
|
2023-02-14 09:38:41 +08:00
|
|
|
|
chat_page.visit_channel(channel)
|
2023-04-12 09:09:06 +08:00
|
|
|
|
channel_page.message_thread_indicator(thread.original_message).click
|
2023-05-31 00:15:34 +08:00
|
|
|
|
|
2023-02-14 09:38:41 +08:00
|
|
|
|
expect(side_panel).to have_open_thread(thread)
|
|
|
|
|
end
|
2024-02-02 01:27:38 +08:00
|
|
|
|
|
|
|
|
|
it "navigates back to channel when clicking original message link", mobile: true do
|
|
|
|
|
chat_page.visit_thread(thread)
|
|
|
|
|
|
|
|
|
|
find(".chat-message-info__original-message").click
|
|
|
|
|
|
|
|
|
|
expect(page).to have_current_path("/chat/c/#{channel.slug}/#{channel.id}")
|
|
|
|
|
end
|
2023-02-14 09:38:41 +08:00
|
|
|
|
end
|
2024-01-19 23:21:48 +08:00
|
|
|
|
|
|
|
|
|
context "when messages are separated by a day" do
|
|
|
|
|
before do
|
|
|
|
|
Fabricate(:chat_message, chat_channel: channel, thread: thread, created_at: 2.days.ago)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "shows a date separator" do
|
|
|
|
|
chat_page.visit_thread(thread)
|
|
|
|
|
|
|
|
|
|
expect(page).to have_selector(".chat-thread .chat-message-separator__text", text: "Today")
|
|
|
|
|
end
|
|
|
|
|
end
|
2023-02-14 09:38:41 +08:00
|
|
|
|
end
|
|
|
|
|
end
|