Skip to content

A platform for community discussion. Free, open, simple.

UX: shows search button on channels list in drawer (#36080)

Joffrey JAFFEUX8a92ee023c76
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/drawer-routes/channels.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/drawer-routes/channels.gjs
index b66bf1a8b8c..67a2cc26f24 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat/drawer-routes/channels.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat/drawer-routes/channels.gjs
@@ -14,6 +14,7 @@ export default class ChatDrawerRoutesChannels extends Component {
<Navbar @onClick={{this.chat.toggleDrawer}} as |navbar|>
<navbar.Title @title={{i18n "chat.heading"}} />
<navbar.Actions as |a|>
+ <a.SearchButton />
<a.ToggleDrawerButton />
<a.FullPageButton />
<a.CloseDrawerButton />
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/navbar/search-button.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/navbar/search-button.gjs
index 5b292ad4287..0b0e848365f 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat/navbar/search-button.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat/navbar/search-button.gjs
@@ -4,7 +4,7 @@ const SearchButton = <template>
<DButton
@icon="magnifying-glass"
@route="chat.search"
- class="btn-transparent"
+ class="btn-transparent chat-channel-search-btn"
/>
</template>;
diff --git a/plugins/chat/spec/system/chat_channel_search/drawer_spec.rb b/plugins/chat/spec/system/chat_channel_search/drawer_spec.rb
index de85749ac7e..5d6d8aee0a4 100644
--- a/plugins/chat/spec/system/chat_channel_search/drawer_spec.rb
+++ b/plugins/chat/spec/system/chat_channel_search/drawer_spec.rb
@@ -18,6 +18,14 @@ RSpec.describe "Chat channel search - drawer", type: :system do
let(:channel_page) { PageObjects::Pages::ChatChannel.new }
let(:drawer_page) { PageObjects::Pages::ChatDrawer.new }
+ context "when navigating on chat channels" do
+ it "shows a button for chat search" do
+ drawer_page.visit_index
+
+ expect(page).to have_selector(".chat-channel-search-btn")
+ end
+ end
+
context "when searching for messages" do
it "shows search results and allows navigation" do
message_1 =