1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-19 01:33:33 +00:00

[Soft Delete] soft-delete by default

This commit is contained in:
Chad Scharf
2020-04-14 14:32:43 -04:00
parent 49f1fac3ed
commit 5dd9963618
3 changed files with 9 additions and 8 deletions

View File

@@ -39,10 +39,10 @@ export class DeleteCommand {
}
try {
if (cmd.trash) {
await this.cipherService.softDeleteWithServer(id);
} else {
if (cmd.permanent) {
await this.cipherService.deleteWithServer(id);
} else {
await this.cipherService.softDeleteWithServer(id);
}
return Response.success();
} catch (e) {

View File

@@ -58,6 +58,7 @@ export class ListCommand {
private async listCiphers(cmd: program.Command) {
let ciphers: CipherView[];
cmd.trash = cmd.trash || false;
if (cmd.url != null && cmd.url.trim() !== '') {
ciphers = await this.cipherService.getAllDecryptedForUrl(cmd.url);
} else {
@@ -66,7 +67,7 @@ export class ListCommand {
if (cmd.folderid != null || cmd.collectionid != null || cmd.organizationid != null) {
ciphers = ciphers.filter((c) => {
if (cmd.trash && !c.isDeleted) {
if (cmd.trash !== c.isDeleted) {
return false;
}
if (cmd.folderid != null) {
@@ -104,11 +105,11 @@ export class ListCommand {
return false;
});
} else if (cmd.search == null || cmd.search.trim() === '') {
ciphers = ciphers.filter((c) => (cmd.trash || false) === c.isDeleted);
ciphers = ciphers.filter((c) => cmd.trash === c.isDeleted);
}
if (cmd.search != null && cmd.search.trim() !== '') {
ciphers = this.searchService.searchCiphersBasic(ciphers, cmd.search, cmd.trash || false);
ciphers = this.searchService.searchCiphersBasic(ciphers, cmd.search, cmd.trash);
}
const res = new ListResponse(ciphers.map((o) => new CipherResponse(o)));