Commit bc350ca5 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '348388-add-namespace-to-billing-nav-context' into 'master'

Change billing in side nav experiment to use namespace

See merge request gitlab-org/gitlab!76770
parents dc4d4c14 626f775c
......@@ -22,7 +22,7 @@ class Groups::BillingsController < Groups::ApplicationController
.execute
if @plans_data
track_from_side_nav
track_from_side_nav(relevant_group)
else
render 'shared/billings/customers_dot_unavailable'
end
......@@ -51,9 +51,9 @@ class Groups::BillingsController < Groups::ApplicationController
gitlab_subscription.save
end
def track_from_side_nav
def track_from_side_nav(relevant_group)
return unless helpers.accessed_billing_from_side_nav?
experiment(:billing_in_side_nav, user: current_user).track(:view, label: 'view_billing')
experiment(:billing_in_side_nav, actor: current_user, namespace: relevant_group, sticky_to: current_user).track(:view, label: 'view_billing')
end
end
......@@ -118,7 +118,7 @@ module EE
local_active_routes = { path: 'billings#index' }
experiment(:billing_in_side_nav, user: context.current_user) do |e|
experiment(:billing_in_side_nav, actor: context.current_user, namespace: context.group.root_ancestor, sticky_to: context.current_user) do |e|
e.control {}
e.candidate do
local_active_routes = {
......
......@@ -23,7 +23,7 @@ module EE
private
def add_billing_sidebar_menu
experiment(:billing_in_side_nav, user: context.current_user) do |e|
experiment(:billing_in_side_nav, actor: context.current_user, namespace: context.group.root_ancestor, sticky_to: context.current_user) do |e|
e.control {}
e.candidate do
insert_menu_after(::Sidebars::Groups::Menus::AdministrationMenu, ::Sidebars::Groups::Menus::BillingMenu.new(context))
......
......@@ -23,7 +23,7 @@ module EE
private
def add_billing_sidebar_menu
experiment(:billing_in_side_nav, user: context.current_user) do |e|
experiment(:billing_in_side_nav, actor: context.current_user, namespace: context.project.namespace.root_ancestor, sticky_to: context.current_user) do |e|
e.control {}
e.candidate do
insert_menu_after(::Sidebars::Projects::Menus::SettingsMenu, ::Sidebars::Projects::Menus::BillingMenu.new(context))
......
......@@ -73,7 +73,7 @@ module Sidebars
local_active_routes = { path: 'billings#index' }
experiment(:billing_in_side_nav, user: context.current_user) do |e|
experiment(:billing_in_side_nav, actor: context.current_user, namespace: context.group.root_ancestor, sticky_to: context.current_user) do |e|
e.control {}
e.candidate do
local_active_routes = {
......
......@@ -73,7 +73,7 @@ RSpec.describe Groups::BillingsController, :saas do
it 'assigns the candidate experience and tracks the event' do
expect(experiment(:billing_in_side_nav)).to track(:view, label: 'view_billing')
.for(:candidate)
.with_context(user: user)
.with_context(actor: user, namespace: group)
.on_next_instance
get :index, params: { group_id: group, from: :side_nav }
......
......@@ -3,7 +3,8 @@
require 'spec_helper'
RSpec.describe Sidebars::Projects::Panel do
let(:project) { build(:project) }
let_it_be(:project) { create(:project) }
let(:context) { Sidebars::Projects::Context.new(current_user: nil, container: project) }
subject(:panel) { described_class.new(context) }
......
......@@ -3,7 +3,8 @@
require 'spec_helper'
RSpec.describe Sidebars::Projects::Panel do
let(:project) { build(:project) }
let_it_be(:project) { create(:project) }
let(:context) { Sidebars::Projects::Context.new(current_user: nil, container: project) }
subject { described_class.new(context) }
......
......@@ -3,7 +3,8 @@
require 'spec_helper'
RSpec.describe 'shared/nav/_sidebar.html.haml' do
let(:project) { build(:project, id: non_existing_record_id) }
let_it_be(:project) { create(:project) }
let(:context) { Sidebars::Projects::Context.new(current_user: nil, container: project) }
let(:sidebar) { Sidebars::Projects::Panel.new(context) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment