Handle password protected import export (#1448)

This updates requirements without implementing any way for the UI to
interact with the new feature
This commit is contained in:
Matt Gibson 2022-02-07 15:15:22 -05:00 committed by GitHub
parent 1b28a4b954
commit 6779adb064
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 18 deletions

2
jslib

@ -1 +1 @@
Subproject commit 9caea70ea2dbfdb591ef08a3d33def7f591f1276
Subproject commit 6c08b408470709afb1f6f5bc9d0e0d06d02fa1f5

View File

@ -8,6 +8,7 @@ import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.se
import { PolicyService } from "jslib-common/abstractions/policy.service";
import { PolicyType } from "jslib-common/enums/policyType";
import { ImportType } from "jslib-common/services/import.service";
import Swal, { SweetAlertIcon } from "sweetalert2";
@ -18,7 +19,7 @@ import Swal, { SweetAlertIcon } from "sweetalert2";
export class ImportComponent implements OnInit {
featuredImportOptions: ImportOption[];
importOptions: ImportOption[];
format: string = null;
format: ImportType = null;
fileContents: string;
formPromise: Promise<Error>;
loading: boolean = false;
@ -38,21 +39,6 @@ export class ImportComponent implements OnInit {
async ngOnInit() {
this.setImportOptions();
this.importOptions.sort((a, b) => {
if (a.name == null && b.name != null) {
return -1;
}
if (a.name != null && b.name == null) {
return 1;
}
if (a.name == null && b.name == null) {
return 0;
}
return this.i18nService.collator
? this.i18nService.collator.compare(a.name, b.name)
: a.name.localeCompare(b.name);
});
this.importBlockedByPolicy = await this.policyService.policyAppliesToUser(
PolicyType.PersonalOwnership
@ -158,7 +144,21 @@ export class ImportComponent implements OnInit {
},
...this.importService.featuredImportOptions,
];
this.importOptions = this.importService.regularImportOptions;
this.importOptions = [...this.importService.regularImportOptions].sort((a, b) => {
if (a.name == null && b.name != null) {
return -1;
}
if (a.name != null && b.name == null) {
return 1;
}
if (a.name == null && b.name == null) {
return 0;
}
return this.i18nService.collator
? this.i18nService.collator.compare(a.name, b.name)
: a.name.localeCompare(b.name);
});
}
private async error(error: Error) {