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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Display new user data if user updatet the data (tried with another email)
Inga Mai99f6339a657a
diff --git a/frontend/src/app/components/enterprise/enterprise-active-trial/ee-active-trial.component.ts b/frontend/src/app/components/enterprise/enterprise-active-trial/ee-active-trial.component.tsindex b81a9de6b88..4661b11a2a4 100644--- a/frontend/src/app/components/enterprise/enterprise-active-trial/ee-active-trial.component.ts+++ b/frontend/src/app/components/enterprise/enterprise-active-trial/ee-active-trial.component.ts@@ -26,10 +26,11 @@// See docs/COPYRIGHT.rdoc for more details.// ++-import {Component, ElementRef, OnInit} from "@angular/core";+import {ChangeDetectorRef, Component, ElementRef, OnInit} from "@angular/core";+import {distinctUntilChanged} from "rxjs/operators";+import {UntilDestroyedMixin} from "core-app/helpers/angular/until-destroyed.mixin";import {I18nService} from "app/modules/common/i18n/i18n.service";import {baseUrlAugur, EnterpriseTrialService} from "app/components/enterprise/enterprise-trial.service";-import {DynamicBootstrapper} from "core-app/globals/dynamic-bootstrapper";import {HttpClient, HttpErrorResponse} from "@angular/common/http";export const enterpriseActiveTrialSelector = 'enterprise-active-trial';@@ -39,7 +40,7 @@ export const enterpriseActiveTrialSelector = 'enterprise-active-trial';templateUrl: './ee-active-trial.component.html',styleUrls: ['./ee-active-trial.component.sass']})-export class EEActiveTrialComponent implements OnInit {+export class EEActiveTrialComponent extends UntilDestroyedMixin implements OnInit {public text = {label_email: this.I18n.t('js.admin.enterprise.trial.form.label_email'),label_expires_at: this.I18n.t('js.admin.enterprise.trial.form.label_expires_at'),@@ -55,13 +56,26 @@ export class EEActiveTrialComponent implements OnInit {public expiresAt = this.elementRef.nativeElement.dataset['expiresAt'];constructor(readonly elementRef:ElementRef,+ readonly cdRef:ChangeDetectorRef,readonly I18n:I18nService,protected http:HttpClient,public eeTrialService:EnterpriseTrialService) {+ super();}ngOnInit() {if (!this.subscriber) {+ this.eeTrialService.userData$+ .pipe(+ distinctUntilChanged(),+ this.untilDestroyed()+ )+ .subscribe(data => {+ this.subscriber = data.subscriber;+ this.email = data.email;+ this.cdRef.detectChanges();+ });+this.initialize();}}@@ -69,13 +83,10 @@ export class EEActiveTrialComponent implements OnInit {private initialize():void {let eeTrialKey = this.loadGonData();- if (eeTrialKey) {+ if (eeTrialKey && !this.eeTrialService.userData) {// after reload: get data from Augur using the trial key saved in gonthis.eeTrialService.trialLink = baseUrlAugur + '/public/v1/trials/' + eeTrialKey.value;this.getUserDataFromAugur();- } else {- this.subscriber = this.eeTrialService.userData.subscriber;- this.email = this.eeTrialService.userData.email;}}diff --git a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.ts b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.tsindex 18c1ab0a119..1e99b13210a 100644--- a/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.ts+++ b/frontend/src/app/components/enterprise/enterprise-modal/enterprise-trial.modal.ts@@ -98,7 +98,7 @@ export class EnterpriseTrialModal extends OpModalComponent implements AfterViewIpublic headerText() {if (this.eeTrialService.mailSubmitted) {return this.text.heading_confirmation;- } else if(this.eeTrialService.trialStarted) {+ } else if (this.eeTrialService.trialStarted) {return this.text.heading_next_steps;} else {return this.text.heading_test_ee;diff --git a/frontend/src/app/components/enterprise/enterprise-trial.service.ts b/frontend/src/app/components/enterprise/enterprise-trial.service.tsindex b4ff19a8a51..2d1a25891d3 100644--- a/frontend/src/app/components/enterprise/enterprise-trial.service.ts+++ b/frontend/src/app/components/enterprise/enterprise-trial.service.ts@@ -4,11 +4,15 @@ import {HttpClient, HttpErrorResponse} from "@angular/common/http";import {PathHelperService} from "core-app/modules/common/path-helper/path-helper.service";import {NotificationsService} from "core-app/modules/common/notifications/notifications.service";import {FormGroup} from "@angular/forms";+import {BehaviorSubject} from 'rxjs';export const baseUrlAugur = 'https://augur.openproject-edge.com';@Injectable()export class EnterpriseTrialService {+ // user data needs to be sync in ee-active-trial.component.ts+ private userDataSubject = new BehaviorSubject<any>({});+ public userData$ = this.userDataSubject.asObservable();public userData:{subscriber:string, email:string};public trialLink:string;@@ -36,11 +40,14 @@ export class EnterpriseTrialService {subscriber: form.value.first_name + ' ' + form.value.last_name,email: form.value.email};+ this.userDataSubject.next(this.userData);+this.cancelled = false;this.http.post(baseUrlAugur + '/public/v1/trials', form.value).toPromise().then((enterpriseTrial:any) => {this.trialLink = enterpriseTrial._links.self.href;+ this.saveTrialKey(this.trialLink);this.retryConfirmation();})