refactored a few properties into getters (#272)

This commit is contained in:
Addison Beck 2021-02-12 17:25:47 -05:00 committed by GitHub
parent 0b79f112b9
commit 1968dbfee2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 10 deletions

View File

@ -35,9 +35,7 @@ export class AddEditComponent implements OnInit {
copyLink = false; copyLink = false;
disableSend = false; disableSend = false;
editMode: boolean = false;
send: SendView; send: SendView;
title: string;
deletionDate: string; deletionDate: string;
expirationDate: string; expirationDate: string;
hasPassword: boolean; hasPassword: boolean;
@ -94,15 +92,19 @@ export class AddEditComponent implements OnInit {
await this.load(); await this.load();
} }
async load() { get editMode(): boolean {
this.editMode = this.sendId != null; return this.sendId != null;
if (this.editMode) { }
this.editMode = true;
this.title = this.i18nService.t('editSend');
} else {
this.title = this.i18nService.t('createSend');
}
get title(): string {
return this.i18nService.t(
this.editMode ?
'editSend' :
'createSend'
);
}
async load() {
const policies = await this.policyService.getAll(PolicyType.DisableSend); const policies = await this.policyService.getAll(PolicyType.DisableSend);
const organizations = await this.userService.getAllOrganizations(); const organizations = await this.userService.getAllOrganizations();
this.disableSend = organizations.some(o => { this.disableSend = organizations.some(o => {