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:
@@ -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) {
|
||||
|
||||
@@ -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)));
|
||||
|
||||
Reference in New Issue
Block a user