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

Fix trial request handling

Christophe Bliardb49562896dd7
diff --git a/frontend/src/app/features/enterprise/enterprise-trial.service.ts b/frontend/src/app/features/enterprise/enterprise-trial.service.ts
index e1a418b1d7a..110912e499c 100644
--- a/frontend/src/app/features/enterprise/enterprise-trial.service.ts
+++ b/frontend/src/app/features/enterprise/enterprise-trial.service.ts
@@ -232,7 +232,7 @@ export class EnterpriseTrialService {
} else if (errorResponse?.message) {
this.toastService.addError(errorResponse.message);
} else {
- this.toastService.addError(error.error || I18n.t('js.error.internal'));
+ this.toastService.addError(String(error.error) || I18n.t('js.error.internal'));
}
});
}
@@ -244,7 +244,7 @@ export class EnterpriseTrialService {
// extract token from resend link
const trialKey = resendlink.split('/')[6];
return this.http.post(
- `${this.pathHelper.appBasePath}/admin/enterprise/save_trial_key`,
+ `${this.pathHelper.appBasePath}/admin/enterprise_tokens/save_trial_key`,
{ trial_key: trialKey },
{ withCredentials: true },
)
@@ -258,7 +258,7 @@ export class EnterpriseTrialService {
// save received token in controller
private saveToken(token:string) {
return this.http.post(
- `${this.pathHelper.appBasePath}/admin/enterprise`,
+ `${this.pathHelper.appBasePath}/admin/enterprise_tokens`,
{ enterprise_token: { encoded_token: token } },
{ withCredentials: true },
)
@@ -277,7 +277,7 @@ export class EnterpriseTrialService {
// Without this deletion, we run into an endless loop of an confirmed mail, but no saved token.
void this.http
.delete(
- `${this.pathHelper.api.v3.apiV3Base}/admin/enterprise/delete_trial_key`,
+ `${this.pathHelper.api.v3.apiV3Base}/admin/enterprise_tokens/delete_trial_key`,
{ withCredentials: true },
)
.toPromise();
diff --git a/spec/features/admin/enterprise/enterprise_trial_spec.rb b/spec/features/admin/enterprise/enterprise_trial_spec.rb
index b4477cbd7bc..86edf55f799 100644
--- a/spec/features/admin/enterprise/enterprise_trial_spec.rb
+++ b/spec/features/admin/enterprise/enterprise_trial_spec.rb
@@ -164,7 +164,7 @@ RSpec.describe "Enterprise trial management",
before do
login_as(admin)
- visit enterprise_path
+ visit enterprise_tokens_path
end
def fill_out_modal(mail: "[email protected]")
@@ -247,14 +247,14 @@ RSpec.describe "Enterprise trial management",
proxy.stub("https://start.openproject-edge.com:443/public/v1/trials/#{trial_id}/details")
.and_return(headers: { "Access-Control-Allow-Origin" => "*" }, code: 403)
- visit enterprise_path
+ visit enterprise_tokens_path
- expect(page).to have_css(".attributes-key-value--value-container", text: "OpenProject Test", wait: 20)
- expect(page).to have_css(".attributes-key-value--value-container", text: "01/01/2020")
- expect(page).to have_css(".attributes-key-value--value-container", text: "01/02/2020")
- expect(page).to have_css(".attributes-key-value--value-container", text: "5")
- # Generated expired token has different mail
- expect(page).to have_css(".attributes-key-value--value-container", text: "[email protected]")
+ expect_and_dismiss_flash(message: "Successful update.")
+ expect(page).to have_text("Enterprise Plan (Token Version 1)")
+ expect(page).to have_text("OpenProject Test")
+ expect(page).to have_text("5")
+ expect(page).to have_text("[email protected]") # Generated token has different mail than the one used for trial
+ expect(page).to have_text("01/01/2020 – 01/02/2020")
end
it "can confirm that trial regularly" do
@@ -279,12 +279,11 @@ RSpec.describe "Enterprise trial management",
click_on "Continue"
expect_and_dismiss_flash(message: "Successful update.")
- expect(page).to have_css(".attributes-key-value--value-container", text: "OpenProject Test")
- expect(page).to have_css(".attributes-key-value--value-container", text: "01/01/2020")
- expect(page).to have_css(".attributes-key-value--value-container", text: "01/02/2020")
- expect(page).to have_css(".attributes-key-value--value-container", text: "5")
- # Generated expired token has different mail
- expect(page).to have_css(".attributes-key-value--value-container", text: "[email protected]")
+ expect(page).to have_text("Enterprise Plan (Token Version 1)")
+ expect(page).to have_text("OpenProject Test")
+ expect(page).to have_text("5")
+ expect(page).to have_text("[email protected]") # Generated token has different mail than the one used for trial
+ expect(page).to have_text("01/01/2020 – 01/02/2020")
end
end
end