This repository was archived by the owner on Jul 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +35
-3
lines changed
javascripts/discourse/components
stylesheets/modules/ai-bot-conversations Expand file tree Collapse file tree 4 files changed +35
-3
lines changed Original file line number Diff line number Diff line change 11import Component from " @glimmer/component" ;
2+ import { action } from " @ember/object" ;
23import { service } from " @ember/service" ;
34import DButton from " discourse/components/d-button" ;
45import { AI_CONVERSATIONS_PANEL } from " ../services/ai-conversations-sidebar-manager" ;
@@ -14,12 +15,18 @@ export default class AiBotSidebarNewConversation extends Component {
1415 );
1516 }
1617
18+ @action
19+ routeTo () {
20+ this .router .transitionTo (" /discourse-ai/ai-bot/conversations" );
21+ this .args .outletArgs ? .toggleNavigationMenu ? .();
22+ }
23+
1724 <template >
1825 {{#if this . shouldRender }}
1926 <DButton
20- @ route =" /discourse-ai/ai-bot/conversations"
2127 @ label =" discourse_ai.ai_bot.conversations.new"
2228 @ icon =" plus"
29+ @ action ={{this .routeTo }}
2330 class =" ai-new-question-button btn-default"
2431 />
2532 {{/if }}
Original file line number Diff line number Diff line change 11@use " lib/viewport" ;
22
3- // Hide the new question button from the hamburger menu's footer
4- .hamburger-panel .ai-new-question-button {
3+ // Hide the new question button from the hamburger menu's footer on desktop
4+ .desktop-view . hamburger-panel .ai-new-question-button {
55 display : none ;
66}
77
Original file line number Diff line number Diff line change 272272 expect ( sidebar ) . to have_no_css ( "button.ai-new-question-button" )
273273 end
274274 end
275+
276+ context "with header dropdown on mobile" , mobile : true do
277+ before { SiteSetting . navigation_menu = "header dropdown" }
278+
279+ it "displays the new question button in the menu when viewing a PM" do
280+ ai_pm_homepage . visit
281+ header_dropdown . open
282+ expect ( ai_pm_homepage ) . to have_no_new_question_button
283+
284+ topic_page . visit_topic ( pm )
285+ header_dropdown . open
286+ ai_pm_homepage . click_new_question_button
287+
288+ # Hamburger sidebar is closed
289+ expect ( header_dropdown ) . to have_no_dropdown_visible
290+ end
291+ end
275292end
Original file line number Diff line number Diff line change @@ -32,6 +32,14 @@ def has_no_homepage?
3232 page . has_no_css? ( HOMEPAGE_WRAPPER_CLASS )
3333 end
3434
35+ def has_no_new_question_button?
36+ page . has_no_css? ( ".ai-new-question-button" )
37+ end
38+
39+ def click_new_question_button
40+ page . find ( ".ai-new-question-button" ) . click
41+ end
42+
3543 def persona_selector
3644 PageObjects ::Components ::SelectKit . new ( ".persona-llm-selector__persona-dropdown" )
3745 end
You can’t perform that action at this time.
0 commit comments