Commit f1bafd6f authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch '335367-fix-improper-use-of-glex-for-trial-status-popover-experiment' into 'master'

Fix improper use of GLEX for trial status popover experiment

See merge request gitlab-org/gitlab!65781
parents 16c21707 61fa509b
...@@ -21,7 +21,7 @@ module TrialStatusWidgetHelper ...@@ -21,7 +21,7 @@ module TrialStatusWidgetHelper
base_attrs.merge( base_attrs.merge(
group_name: group.name, group_name: group.name,
purchase_href: ultimate_subscription_path_for_group(group), purchase_href: ultimate_subscription_path_for_group(group),
start_initially_shown: in_forced_popover_experiment?(group) && force_popover_to_be_shown?(group.trial_days_remaining), start_initially_shown: force_popover_to_be_shown?(group),
target_id: base_attrs[:container_id], target_id: base_attrs[:container_id],
trial_end_date: group.trial_ends_on trial_end_date: group.trial_ends_on
) )
...@@ -49,8 +49,18 @@ module TrialStatusWidgetHelper ...@@ -49,8 +49,18 @@ module TrialStatusWidgetHelper
group.trial_active? && can?(current_user, :admin_namespace, group) group.trial_active? && can?(current_user, :admin_namespace, group)
end end
def force_popover_to_be_shown?(days_remaining) def force_popover_to_be_shown?(group)
D14_CALLOUT_RANGE.cover?(days_remaining) || D3_CALLOUT_RANGE.cover?(days_remaining) experiment(:forcibly_show_trial_status_popover, group: group) do |e|
e.use { false }
e.try do
days_remaining = group.trial_days_remaining
D14_CALLOUT_RANGE.cover?(days_remaining) || D3_CALLOUT_RANGE.cover?(days_remaining)
end
e.run
end
end end
def trial_status_common_data_attrs(group) def trial_status_common_data_attrs(group)
...@@ -64,8 +74,4 @@ module TrialStatusWidgetHelper ...@@ -64,8 +74,4 @@ module TrialStatusWidgetHelper
def ultimate_subscription_path_for_group(group) def ultimate_subscription_path_for_group(group)
new_subscriptions_path(namespace_id: group.id, plan_id: ZUORA_ULTIMATE_PLAN_ID) new_subscriptions_path(namespace_id: group.id, plan_id: ZUORA_ULTIMATE_PLAN_ID)
end end
def in_forced_popover_experiment?(group)
experiment(:forcibly_show_trial_status_popover, group: group).variant.group == :experiment
end
end end
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