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

change instance variable to local variable in helper

bsatarnejad1be86fa61fc8
diff --git a/app/helpers/enterprise_helper.rb b/app/helpers/enterprise_helper.rb
index c3b74d53bff..93d7ffedaeb 100644
--- a/app/helpers/enterprise_helper.rb
+++ b/app/helpers/enterprise_helper.rb
@@ -5,11 +5,11 @@ module EnterpriseHelper
end
def write_trial_key_to_gon
- @trial_key = Token::EnterpriseTrialKey.find_by(user_id: User.system.id)
- if @trial_key
+ trial_key = Token::EnterpriseTrialKey.find_by(user_id: User.system.id)
+ if trial_key
gon.ee_trial_key = {
- value: @trial_key.value,
- created: @trial_key.created_at
+ value: trial_key.value,
+ created: trial_key.created_at
}
end
end
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 c9936b014c9..fae97a34cdc 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,7 +114,7 @@ export class EnterpriseTrialModalComponent extends OpModalComponent implements A
if (this.eeTrialService.trialStarted || this.eeTrialService.confirmed) {
window.location.reload();
}
- else if(this.eeTrialService.mailSubmitted) {
+ else if (this.eeTrialService.mailSubmitted) {
window.location.reload();
return;
}
diff --git a/frontend/src/app/features/enterprise/free-trial-button/free-trial-button.component.html b/frontend/src/app/features/enterprise/free-trial-button/free-trial-button.component.html
index 49555912e5b..74922f03dd2 100644
--- a/frontend/src/app/features/enterprise/free-trial-button/free-trial-button.component.html
+++ b/frontend/src/app/features/enterprise/free-trial-button/free-trial-button.component.html
@@ -1,4 +1,4 @@
-<div [attr.data-tooltip]="text.confirmation_info(created, email)" [ngClass]="{'tooltip--top': trialRequested}">
+<div [attr.data-tooltip]="trialRequested ? text.confirmation_info(created, email) : ''" [ngClass]="{'tooltip--top': trialRequested}">
<button [disabled]="trialRequested" class="button -alt-highlight -round" (click)="openTrialModal()">
{{ text.button_trial }}
</button>
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 185144d426f..80939939872 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
@@ -39,7 +39,7 @@ import { OpModalService } from 'core-app/shared/components/modal/modal.service';
import { EnterpriseTrialService } from 'core-app/features/enterprise/enterprise-trial.service';
import { TimezoneService } from 'core-app/core/datetime/timezone.service';
import { distinctUntilChanged } from 'rxjs/operators';
-import { HttpClient, HttpErrorResponse } from '@angular/common/http';
+import { HttpClient } from '@angular/common/http';
import { GonService } from 'core-app/core/gon/gon.service';
export const freeTrialButtonSelector = 'free-trial-button';
@@ -56,11 +56,10 @@ 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) =>
- this.trialRequested ? this.I18n.t('js.admin.enterprise.trial.confirmation_info', {
+ confirmation_info: (date:string, email:string) => this.I18n.t('js.admin.enterprise.trial.confirmation_info', {
date,
email,
- }) : '',
+ }),
};
constructor(protected I18n:I18nService,
@@ -122,7 +121,7 @@ export class FreeTrialButtonComponent implements OnInit {
this.opModalService.show(EnterpriseTrialModalComponent, this.injector);
}
- public get trialRequested() {
+ public get trialRequested(): boolean {
const eeTrialKey = this.Gon.get('ee_trial_key') as any;
return (eeTrialKey && eeTrialKey !== undefined);
}