From a7a7d8e41eaab49e846bab5704a750915f9c6e4f Mon Sep 17 00:00:00 2001
From: Joffrey JAFFEUX <j.jaffeux@gmail.com>
Date: Thu, 30 Nov 2023 19:33:41 +0100
Subject: [PATCH] DEV: correctly uses link to message endpoint in spec (#24652)

- correctly uses link to message endpoint in spec
- correctly uses "chat with"
---
 .../assets/javascripts/discourse/initializers/chat-sidebar.js | 2 +-
 plugins/chat/spec/system/chat_channel_spec.rb                 | 4 ++--
 plugins/chat/spec/system/sidebar_navigation_menu_spec.rb      | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js b/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js
index 350f9649e07..e724d8f830b 100644
--- a/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js
+++ b/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js
@@ -279,7 +279,7 @@ export default {
                 });
               } else {
                 return I18n.t("chat.placeholder_users", {
-                  commaSeparatedNames: this.channel.chatable.users[0].username,
+                  commaSeparatedNames: this.channel.escapedTitle,
                 });
               }
             }
diff --git a/plugins/chat/spec/system/chat_channel_spec.rb b/plugins/chat/spec/system/chat_channel_spec.rb
index 50729243847..52b581bf7d7 100644
--- a/plugins/chat/spec/system/chat_channel_spec.rb
+++ b/plugins/chat/spec/system/chat_channel_spec.rb
@@ -136,7 +136,7 @@ RSpec.describe "Chat channel", type: :system do
 
     it "jumps to the bottom of the channel" do
       unloaded_message = Fabricate(:chat_message, chat_channel: channel_1)
-      visit("/chat/message/#{message_1.id}")
+      visit("/chat/c/-/#{channel_1.id}/#{message_1.id}")
 
       expect(channel_page).to have_no_loading_skeleton
       expect(page).to have_no_css("[data-id='#{unloaded_message.id}']")
@@ -168,7 +168,7 @@ RSpec.describe "Chat channel", type: :system do
     end
 
     xit "doesn’t scroll the pane" do
-      visit("/chat/message/#{message_1.id}")
+      visit("/chat/c/-/#{channel_1.id}/#{message_1.id}")
 
       new_message = Fabricate(:chat_message, chat_channel: channel_1)
 
diff --git a/plugins/chat/spec/system/sidebar_navigation_menu_spec.rb b/plugins/chat/spec/system/sidebar_navigation_menu_spec.rb
index a6cb8329d8e..93d473d2ffd 100644
--- a/plugins/chat/spec/system/sidebar_navigation_menu_spec.rb
+++ b/plugins/chat/spec/system/sidebar_navigation_menu_spec.rb
@@ -182,7 +182,7 @@ RSpec.describe "Sidebar navigation menu", type: :system do
         visit("/")
 
         expect(sidebar_page.dms_section.find(".channel-#{dm_channel_1.id}")["title"]).to eq(
-          "Chat in @&lt;script&gt;alert(&#x27;hello&#x27;)&lt;/script&gt;",
+          "Chat with @&lt;script&gt;alert(&#x27;hello&#x27;)&lt;/script&gt;",
         )
       end
     end