Commit 45dfc11d authored by Jay Swain's avatar Jay Swain

Provide namespace_id default value

After https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70196 was
merged, and testing on staging we noticed that the namespace_id
parameter was missing. This MR is a bugfix, to provide the
namespace_id parameter when it's not provided.

part of:
https://gitlab.com/gitlab-org/gitlab/-/issues/339654

Changelog: fixed
parent 0fd139ec
...@@ -35,6 +35,7 @@ class TrialsController < ApplicationController ...@@ -35,6 +35,7 @@ class TrialsController < ApplicationController
if params[:glm_source] == 'about.gitlab.com' if params[:glm_source] == 'about.gitlab.com'
redirect_to(new_users_sign_up_group_path(url_params.merge(trial_onboarding_flow: true))) redirect_to(new_users_sign_up_group_path(url_params.merge(trial_onboarding_flow: true)))
elsif @namespace = helpers.only_trialable_group_namespace elsif @namespace = helpers.only_trialable_group_namespace
params[:namespace_id] = @namespace.id
apply_trial_and_redirect apply_trial_and_redirect
else else
redirect_to select_trials_url(url_params) redirect_to select_trials_url(url_params)
......
...@@ -127,10 +127,9 @@ RSpec.describe TrialsController do ...@@ -127,10 +127,9 @@ RSpec.describe TrialsController do
context 'when the ApplyTrialService is successful' do context 'when the ApplyTrialService is successful' do
it 'applies a trial to the namespace' do it 'applies a trial to the namespace' do
gl_com_params = { gitlab_com_trial: true, sync_to_gl: true }
apply_trial_params = { apply_trial_params = {
uid: user.id, uid: user.id,
trial_user: ActionController::Parameters.new(post_params).permit(:namespace_id).merge(gl_com_params) trial_user: ActionController::Parameters.new(post_params).permit(:namespace_id).merge(namespace_id: namespace.id, gitlab_com_trial: true, sync_to_gl: true)
} }
expect_next_instance_of(GitlabSubscriptions::ApplyTrialService) do |service| expect_next_instance_of(GitlabSubscriptions::ApplyTrialService) do |service|
......
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