From c2eafba442d04a612926c2828824eee1f749c5f5 Mon Sep 17 00:00:00 2001
From: Chad Scharf <3904944+cscharf@users.noreply.github.com>
Date: Mon, 13 Apr 2020 15:13:10 -0400
Subject: [PATCH 1/2] [Soft Delete] - Added trash to desktop app
---
jslib | 2 +-
src/app/vault/ciphers.component.html | 4 +--
src/app/vault/groupings.component.html | 5 +++
src/app/vault/vault.component.html | 5 +--
src/app/vault/vault.component.ts | 50 +++++++++++++++++++-------
src/app/vault/view.component.html | 15 ++++++--
src/locales/en/messages.json | 28 +++++++++++++++
7 files changed, 89 insertions(+), 20 deletions(-)
diff --git a/jslib b/jslib
index 72e3893f8e..e9db844285 160000
--- a/jslib
+++ b/jslib
@@ -1 +1 @@
-Subproject commit 72e3893f8eee79f1e3678839aa194f1096c343ea
+Subproject commit e9db844285e21525f5152e782063f04e02543553
diff --git a/src/app/vault/ciphers.component.html b/src/app/vault/ciphers.component.html
index 4c97530f79..55faedc2ce 100644
--- a/src/app/vault/ciphers.component.html
+++ b/src/app/vault/ciphers.component.html
@@ -39,8 +39,8 @@
diff --git a/src/app/vault/groupings.component.html b/src/app/vault/groupings.component.html
index 4f47e43c88..2104dec5a9 100644
--- a/src/app/vault/groupings.component.html
+++ b/src/app/vault/groupings.component.html
@@ -13,6 +13,11 @@
{{'favorites' | i18n}}
+
+
+ {{'trash' | i18n}}
+
+
{{'types' | i18n}}
diff --git a/src/app/vault/vault.component.html b/src/app/vault/vault.component.html
index 98ab31d7d5..93938ac95f 100644
--- a/src/app/vault/vault.component.html
+++ b/src/app/vault/vault.component.html
@@ -2,7 +2,7 @@
+ (onCollectionClicked)="filterCollection($event.id)" (onTrashClicked)="filterDeleted()">
+ (onViewCipherPasswordHistory)="viewCipherPasswordHistory($event)" (onRestoredCipher)="restoredCipher($event)"
+ (onDeletedCipher)="deletedCipher($event)">
this.functionWithChangeDetection(() => {
- this.editCipher(cipher);
- }),
- }));
- menu.append(new remote.MenuItem({
- label: this.i18nService.t('clone'),
- click: () => this.functionWithChangeDetection(() => {
- this.cloneCipher(cipher);
- }),
- }));
+ if (!cipher.isDeleted) {
+ menu.append(new remote.MenuItem({
+ label: this.i18nService.t('edit'),
+ click: () => this.functionWithChangeDetection(() => {
+ this.editCipher(cipher);
+ }),
+ }));
+ menu.append(new remote.MenuItem({
+ label: this.i18nService.t('clone'),
+ click: () => this.functionWithChangeDetection(() => {
+ this.cloneCipher(cipher);
+ }),
+ }));
+ }
switch (cipher.type) {
case CipherType.Login:
@@ -402,6 +408,13 @@ export class VaultComponent implements OnInit, OnDestroy {
await this.ciphersComponent.refresh();
}
+ async restoredCipher(cipher: CipherView) {
+ this.cipherId = null;
+ this.action = null;
+ this.go();
+ await this.ciphersComponent.refresh();
+ }
+
editCipherAttachments(cipher: CipherView) {
if (this.modal != null) {
this.modal.close();
@@ -498,6 +511,15 @@ export class VaultComponent implements OnInit, OnDestroy {
this.go();
}
+ async filterDeleted() {
+ this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchTrash');
+ this.ciphersComponent.deleted = true;
+ await this.ciphersComponent.reload(null, true);
+ this.clearFilters();
+ this.deleted = true;
+ this.go();
+ }
+
async filterCipherType(type: CipherType) {
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchType');
await this.ciphersComponent.reload((c) => c.type === type);
@@ -630,6 +652,7 @@ export class VaultComponent implements OnInit, OnDestroy {
this.addCollectionIds = null;
this.addType = null;
this.addOrganizationId = null;
+ this.deleted = false;
}
private go(queryParams: any = null) {
@@ -641,6 +664,7 @@ export class VaultComponent implements OnInit, OnDestroy {
type: this.type,
folderId: this.folderId,
collectionId: this.collectionId,
+ deleted: this.deleted ? true : null,
};
}
diff --git a/src/app/vault/view.component.html b/src/app/vault/view.component.html
index b197353aee..8752b096b0 100644
--- a/src/app/vault/view.component.html
+++ b/src/app/vault/view.component.html
@@ -273,10 +273,21 @@
diff --git a/src/locales/en/messages.json b/src/locales/en/messages.json
index 2fe5e3ebf3..a932ec9b89 100644
--- a/src/locales/en/messages.json
+++ b/src/locales/en/messages.json
@@ -1292,5 +1292,33 @@
"lock": {
"message": "Lock",
"description": "Verb form: to make secure or inaccesible by"
+ },
+ "trash": {
+ "message": "Trash",
+ "description": "Noun: a special folder to hold deleted items"
+ },
+ "searchTrash": {
+ "message": "Search trash"
+ },
+ "permanentlyDeleteItem": {
+ "message": "Permanently Delete Item"
+ },
+ "permanentlyDeleteItemConfirmation": {
+ "message": "Are you sure you want to permanently delete this item?"
+ },
+ "permanentlyDeletedItem": {
+ "message": "Permanently Deleted item"
+ },
+ "restoreItem": {
+ "message": "Restore Item"
+ },
+ "restoreItemConfirmation": {
+ "message": "Are you sure you want to restore this item?"
+ },
+ "restoredItem": {
+ "message": "Restored Item"
+ },
+ "permanentlyDelete": {
+ "message": "Permanently Delete"
}
}
From 129ecc1ca8bcf3b7d7913fe7fdd8f6bdacc06319 Mon Sep 17 00:00:00 2001
From: Chad Scharf <3904944+cscharf@users.noreply.github.com>
Date: Mon, 13 Apr 2020 15:29:15 -0400
Subject: [PATCH 2/2] [Soft Delete] - Ciphers add button cleanup
---
src/app/vault/ciphers.component.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/app/vault/ciphers.component.html b/src/app/vault/ciphers.component.html
index 55faedc2ce..9c441dab49 100644
--- a/src/app/vault/ciphers.component.html
+++ b/src/app/vault/ciphers.component.html
@@ -39,7 +39,7 @@