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