Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Adapt already_retrieved message

Oliver Güntherdc78a0679ee7
diff --git a/app/services/enterprise_trials/augur_load_trial_service.rb b/app/services/enterprise_trials/augur_load_trial_service.rb
index 2b090d9121d..82a191ec024 100644
--- a/app/services/enterprise_trials/augur_load_trial_service.rb
+++ b/app/services/enterprise_trials/augur_load_trial_service.rb
@@ -66,6 +66,9 @@ module EnterpriseTrials
def handle_successful_trial(trial_json)
if trial_json["token"].nil?
+ # Ensure we delete the trial key regardless of the outcome
+ # as reloading it would always end in the same non-successful flow
+ @trial_key.destroy
return ServiceResult.success(result: nil, message: I18n.t("ee.trial.already_retrieved"))
end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 8ed060ddaaf..9a058a810c9 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -2192,7 +2192,9 @@ en:
trial:
not_found: "You have requested a trial token, but that request is no longer available. Please try again."
wait_for_confirmation: "We sent you an email to confirm your address in order to retrieve a trial token."
- already_retrieved: "Your trial enterprise token was already retrieved. Please reach out to our support team if you need a new one."
+ already_retrieved: >
+ Your trial enterprise token was already retrieved. Please check your emails for the token being attached.
+ Please reach out to our support team if you need a new one.
successfully_saved: "Your trial enterprise token has been successfully retrieved."
token_sent: "Trial token requested"
request_again: "Request again"
diff --git a/spec/services/enterprise_trials/augur_load_trial_service_spec.rb b/spec/services/enterprise_trials/augur_load_trial_service_spec.rb
index 425f8845051..0400ac6c892 100644
--- a/spec/services/enterprise_trials/augur_load_trial_service_spec.rb
+++ b/spec/services/enterprise_trials/augur_load_trial_service_spec.rb
@@ -100,7 +100,7 @@ RSpec.describe EnterpriseTrials::AugurLoadTrialService, :webmock do
expect(result).to be_success
expect(result.message).to eq(I18n.t("ee.trial.already_retrieved"))
- expect(Token::EnterpriseTrialKey).to exist(trial_key.id)
+ expect(Token::EnterpriseTrialKey).not_to exist(trial_key.id)
expect(EnterpriseToken).not_to have_received(:new)
end
end