diff --git a/app/views/layouts/_page.html.haml b/app/views/layouts/_page.html.haml index 655153807fa900faf6eb968479d831331ce15576..993c834c7d61bbc80269ceaedec47ebdbe6790b1 100644 --- a/app/views/layouts/_page.html.haml +++ b/app/views/layouts/_page.html.haml @@ -10,7 +10,7 @@ - sidebar_data = super_sidebar_context(current_user, group: group, project: @project, panel: sidebar_panel, panel_type: nav).to_json %aside.js-super-sidebar.super-sidebar.super-sidebar-loading{ data: { root_path: root_path, sidebar: sidebar_data, force_desktop_expanded_sidebar: @force_desktop_expanded_sidebar.to_s, command_palette: command_palette_data(project: @project, current_ref: current_ref).to_json, is_saas: Gitlab.com?.to_s } } - = render_if_exists "layouts/tanuki_bot_chat" if context + = render_if_exists "layouts/tanuki_bot_chat" = render_if_exists "layouts/session_expire_modal" - if project_studio_enabled? diff --git a/app/views/layouts/nav/_top_bar.html.haml b/app/views/layouts/nav/_top_bar.html.haml index 927d112e53d3c9a946f271a9414f2981840d0f0f..562590ed54558b5ca1427ed430c76a5a1d879720 100644 --- a/app/views/layouts/nav/_top_bar.html.haml +++ b/app/views/layouts/nav/_top_bar.html.haml @@ -1,4 +1,4 @@ -- duo_button_enabled = (partial_exists? "layouts/nav/ask_duo_button") && ::Gitlab::Llm::TanukiBot.show_breadcrumbs_entry_point?(user: current_user, container: @group || @project) +- duo_button_enabled = (partial_exists? "layouts/nav/ask_duo_button") && ::Gitlab::Llm::TanukiBot.show_breadcrumbs_entry_point?(user: current_user) %div{ class: ['top-bar-fixed container-fluid', paneled_view && 'gl-rounded-t-lg gl-sticky gl-top-0 gl-left-0 gl-mx-0 gl-w-full'], data: { testid: 'top-bar' } } .top-bar-container.gl-flex.gl-items-center.gl-gap-2{ class: ("gl-group top-bar-duo-button-present" if duo_button_enabled) } diff --git a/ee/lib/gitlab/llm/tanuki_bot.rb b/ee/lib/gitlab/llm/tanuki_bot.rb index 0870efb950d665da97fa5e7a3e9e5c413cce9d5e..28121281d3c03c0a14c2cda5bcd03daf11d2295b 100644 --- a/ee/lib/gitlab/llm/tanuki_bot.rb +++ b/ee/lib/gitlab/llm/tanuki_bot.rb @@ -25,8 +25,8 @@ def self.agentic_mode_available?(user:, project:, group:) end end - def self.show_breadcrumbs_entry_point?(user:, container: nil) - return false unless chat_enabled?(user) && container + def self.show_breadcrumbs_entry_point?(user:) + return false unless chat_enabled?(user) Gitlab::Llm::Chain::Utils::ChatAuthorizer.user(user: user).allowed? end diff --git a/ee/spec/lib/gitlab/llm/tanuki_bot_spec.rb b/ee/spec/lib/gitlab/llm/tanuki_bot_spec.rb index 30610edc2cec0441313ae95ae23648e3345cbdd0..2e2ae8883406a0aff35d40ce1437b292a822f042 100644 --- a/ee/spec/lib/gitlab/llm/tanuki_bot_spec.rb +++ b/ee/spec/lib/gitlab/llm/tanuki_bot_spec.rb @@ -158,7 +158,6 @@ describe '.show_breadcrumbs_entry_point' do let(:authorizer_response) { instance_double(Gitlab::Llm::Utils::Authorizer::Response, allowed?: allowed) } - let(:allowed) { true } before do allow(described_class).to receive(:chat_enabled?).with(user) @@ -167,26 +166,18 @@ .and_return(authorizer_response) end - where(:container, :ai_features_enabled_for_user, :allowed, :duo_chat_access) do + where(:ai_features_enabled_for_user, :allowed, :duo_chat_access) do [ - [:project, true, true, true], - [:project, true, false, false], - [:project, false, false, false], - [:project, false, true, false], - [:group, true, true, true], - [:group, true, false, false], - [:group, false, false, false], - [:group, false, true, false], - [nil, true, true, false], - [nil, true, false, false], - [nil, false, false, false], - [nil, false, true, false] + [true, true, true], + [true, false, false], + [false, true, false], + [false, false, false] ] end with_them do it 'shows button in correct cases' do - expect(described_class.show_breadcrumbs_entry_point?(user: user, container: container)).to be(duo_chat_access) + expect(described_class.show_breadcrumbs_entry_point?(user: user)).to be(duo_chat_access) end end end diff --git a/qa/qa/specs/features/ee/browser_ui/16_ai_powered/duo_chat/duo_chat_spec.rb b/qa/qa/specs/features/ee/browser_ui/16_ai_powered/duo_chat/duo_chat_spec.rb index 286645c74574fd47bfc02762d3eb0a2706941a5a..f2ce832c2c5e584126381128e22ab09234ef98c5 100644 --- a/qa/qa/specs/features/ee/browser_ui/16_ai_powered/duo_chat/duo_chat_spec.rb +++ b/qa/qa/specs/features/ee/browser_ui/16_ai_powered/duo_chat/duo_chat_spec.rb @@ -7,7 +7,6 @@ module QA let(:user) { Runtime::User::Store.test_user } let(:api_client) { Runtime::User::Store.default_api_client } let(:token) { api_client.personal_access_token } - let(:project) { create(:project, name: 'duo-chat-project', api_client: api_client) } shared_examples 'Duo Chat' do |testcase| it 'a valid response is returned', testcase: testcase do @@ -30,7 +29,6 @@ module QA before do Flow::Login.sign_in(as: user) - project.visit! end context "when asking 'hi'" do