diff --git a/ee/app/controllers/subscriptions/trials/duo_pro_controller.rb b/ee/app/controllers/subscriptions/trials/duo_pro_controller.rb index f9c330256345dcf2ff9bb5ebd500f646a4f00c4d..0121dd2ac04d07e2c18ea15550e89dc51ebe3771 100644 --- a/ee/app/controllers/subscriptions/trials/duo_pro_controller.rb +++ b/ee/app/controllers/subscriptions/trials/duo_pro_controller.rb @@ -8,6 +8,7 @@ class DuoProController < ApplicationController include GoogleAnalyticsCSP include RegistrationsTracking include ::Gitlab::Utils::StrongMemoize + include SafeFormatHelper layout 'minimal' @@ -39,6 +40,8 @@ def create track_event('duo_pro_trial_registration_success') + flash[:success] = success_flash_message + redirect_to group_usage_quotas_path(@result.payload[:namespace], anchor: 'code-suggestions-usage-tab') elsif @result.reason == GitlabSubscriptions::Trials::CreateDuoProService::NO_SINGLE_NAMESPACE # lead created, but we now need to select namespace and then apply a trial @@ -98,6 +101,19 @@ def lead_params def trial_params params.permit(:new_group_name, :namespace_id, :trial_entity, :glm_source, :glm_content).to_h end + + def success_flash_message + safe_format( + s_( + 'DuoProTrial|You have successfully created a trial subscription for GitLab Duo Pro. ' \ + 'It will expire on %{exp_date}.%{new_line}To get started, enable the GitLab Duo Pro ' \ + 'add-on for team members on this page by turning on the toggle for each team member. ' \ + "The subscription may take a minute to sync, so refresh the page if it's not visible yet." + ), + exp_date: 30.days.from_now.strftime('%Y-%m-%d'), + new_line: '<br>'.html_safe + ) + end end end end diff --git a/ee/spec/requests/subscriptions/trials/duo_pro_controller_spec.rb b/ee/spec/requests/subscriptions/trials/duo_pro_controller_spec.rb index ef0263d4c603642a675ea1d670d75a04eeb10e59..279e6379851c9508790eb3a56a23ad31e91537a2 100644 --- a/ee/spec/requests/subscriptions/trials/duo_pro_controller_spec.rb +++ b/ee/spec/requests/subscriptions/trials/duo_pro_controller_spec.rb @@ -153,6 +153,19 @@ expect(post_create).to redirect_to(group_usage_quotas_path(group, anchor: 'code-suggestions-usage-tab')) end + it 'shows valid flash message' do + post_create + + expect(flash[:success]).to include( + 'You have successfully created a trial subscription for GitLab Duo Pro. It will expire on' + ) + + expect(flash[:success]).to include( + 'To get started, enable the GitLab Duo Pro add-on for team members on this page by ' \ + 'turning on the toggle for each team member. The subscription may take a minute to sync' + ) + end + it_behaves_like 'with tracking trial registration', 'duo_pro_trial_registration_success' end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 2e9dfa1a2726460457cd976bdc06057599613ead..f88e6f89ead38ddda8f1e9eac581b1f1c014cffc 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -18873,6 +18873,9 @@ msgstr "" msgid "DuoProTrial|We just need some additional information to activate your trial." msgstr "" +msgid "DuoProTrial|You have successfully created a trial subscription for GitLab Duo Pro. It will expire on %{exp_date}.%{new_line}To get started, enable the GitLab Duo Pro add-on for team members on this page by turning on the toggle for each team member. The subscription may take a minute to sync, so refresh the page if it's not visible yet." +msgstr "" + msgid "Duplicate page: A page with that title already exists in the file %{file}" msgstr ""