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

after sending email for starting trial, the page should be refreshed

bsatarnejad992c3274d0eb
diff --git a/frontend/src/app/features/enterprise/enterprise-modal/enterprise-trial.modal.html b/frontend/src/app/features/enterprise/enterprise-modal/enterprise-trial.modal.html
index ec0be0c9b8e..e336479358b 100644
--- a/frontend/src/app/features/enterprise/enterprise-modal/enterprise-trial.modal.html
+++ b/frontend/src/app/features/enterprise/enterprise-modal/enterprise-trial.modal.html
@@ -1,5 +1,5 @@
<div class="op-modal op-enterprise-modal">
- <op-modal-header (close)="closeMe($event)">{{headerText()}}</op-modal-header>
+ <op-modal-header (close)="closeModal($event)">{{headerText()}}</op-modal-header>
<div [ngSwitch]="openWindow()" class="op-modal--body">
<!-- first modal window -->
diff --git a/frontend/src/app/features/enterprise/enterprise-modal/enterprise-trial.modal.ts b/frontend/src/app/features/enterprise/enterprise-modal/enterprise-trial.modal.ts
index 0b23ca300eb..c9936b014c9 100644
--- a/frontend/src/app/features/enterprise/enterprise-modal/enterprise-trial.modal.ts
+++ b/frontend/src/app/features/enterprise/enterprise-modal/enterprise-trial.modal.ts
@@ -114,6 +114,10 @@ export class EnterpriseTrialModalComponent extends OpModalComponent implements A
if (this.eeTrialService.trialStarted || this.eeTrialService.confirmed) {
window.location.reload();
}
+ else if(this.eeTrialService.mailSubmitted) {
+ window.location.reload();
+ return;
+ }
this.eeTrialService.modalOpen = false;
}
diff --git a/frontend/src/app/features/enterprise/free-trial-button/free-trial-button.component.ts b/frontend/src/app/features/enterprise/free-trial-button/free-trial-button.component.ts
index 095b8d53157..185144d426f 100644
--- a/frontend/src/app/features/enterprise/free-trial-button/free-trial-button.component.ts
+++ b/frontend/src/app/features/enterprise/free-trial-button/free-trial-button.component.ts
@@ -40,6 +40,7 @@ import { EnterpriseTrialService } from 'core-app/features/enterprise/enterprise-
import { TimezoneService } from 'core-app/core/datetime/timezone.service';
import { distinctUntilChanged } from 'rxjs/operators';
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
+import { GonService } from 'core-app/core/gon/gon.service';
export const freeTrialButtonSelector = 'free-trial-button';
@@ -55,12 +56,11 @@ export class FreeTrialButtonComponent implements OnInit {
public text = {
button_trial: this.I18n.t('js.admin.enterprise.upsale.button_start_trial'),
- confirmation_info: (date:string, email:string) => {
- return this.trialRequested ? this.I18n.t('js.admin.enterprise.trial.confirmation_info', {
- date,
- email,
- }) : ''
- },
+ confirmation_info: (date:string, email:string) =>
+ this.trialRequested ? this.I18n.t('js.admin.enterprise.trial.confirmation_info', {
+ date,
+ email,
+ }) : '',
};
constructor(protected I18n:I18nService,
@@ -68,34 +68,36 @@ export class FreeTrialButtonComponent implements OnInit {
readonly injector:Injector,
readonly http:HttpClient,
readonly cdRef:ChangeDetectorRef,
+ readonly Gon:GonService,
public eeTrialService:EnterpriseTrialService,
readonly timezoneService:TimezoneService) {
}
ngOnInit():void {
this.eeTrialService.userData$
- .values$()
- .pipe(
- distinctUntilChanged(),
- )
- .subscribe((userForm) => {
- this.email = userForm.email;
- this.cdRef.detectChanges();
- });
+ .values$()
+ .pipe(
+ distinctUntilChanged(),
+ )
+ .subscribe((userForm) => {
+ this.email = userForm.email;
+ this.cdRef.detectChanges();
+ });
- this.initialize();
+ this.initialize();
}
private initialize():void {
- const eeTrialKey = (window as any).gon.ee_trial_key;
- if (window.gon.ee_trial_key) {
+ const eeTrialKey = this.Gon.get('ee_trial_key') as any;
+ if (eeTrialKey) {
const savedDateStr = eeTrialKey.created.split(' ')[0];
this.created = this.timezoneService.formattedDate(savedDateStr);
- }
- if (eeTrialKey && !this.eeTrialService.userData$.hasValue()) {
- // after reload: get data from Augur using the trial key saved in gon
- this.eeTrialService.trialLink = `${this.eeTrialService.baseUrlAugur}/public/v1/trials/${eeTrialKey.value}`;
- this.getUserDataFromAugur();
+
+ if (!this.eeTrialService.userData$.hasValue()) {
+ // after reload: get data from Augur using the trial key saved in gon
+ this.eeTrialService.trialLink = `${this.eeTrialService.baseUrlAugur}/public/v1/trials/${eeTrialKey.value}`;
+ this.getUserDataFromAugur();
+ }
}
}
@@ -107,11 +109,12 @@ export class FreeTrialButtonComponent implements OnInit {
this.eeTrialService.userData$.putValue(userForm);
this.eeTrialService.retryConfirmation();
})
- .catch((error:HttpErrorResponse) => {
+ .catch(() => {
// Check whether the mail has been confirmed by now
this.eeTrialService.getToken();
});
}
+
public openTrialModal():void {
// cancel request and open first modal window
this.eeTrialService.cancelled = true;
@@ -120,6 +123,7 @@ export class FreeTrialButtonComponent implements OnInit {
}
public get trialRequested() {
- return window.gon.ee_trial_key !== undefined;
+ const eeTrialKey = this.Gon.get('ee_trial_key') as any;
+ return (eeTrialKey && eeTrialKey !== undefined);
}
}