mirror of
https://github.com/bitwarden/browser
synced 2026-02-18 18:33:50 +00:00
[PM-30748] update archived restored toast (#18367)
This commit is contained in:
committed by
jaasen-livefront
parent
b632709743
commit
5b1f659b68
@@ -2473,6 +2473,9 @@
|
||||
"permanentlyDeletedItem": {
|
||||
"message": "Item permanently deleted"
|
||||
},
|
||||
"archivedItemRestored": {
|
||||
"message": "Archived item restored"
|
||||
},
|
||||
"restoreItem": {
|
||||
"message": "Restore item"
|
||||
},
|
||||
|
||||
@@ -115,15 +115,22 @@ export class TrashListItemsContainerComponent {
|
||||
}
|
||||
|
||||
async restore(cipher: PopupCipherViewLike) {
|
||||
let toastMessage;
|
||||
try {
|
||||
const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
|
||||
await this.cipherService.restoreWithServer(cipher.id as string, activeUserId);
|
||||
|
||||
if (cipher.archivedDate) {
|
||||
toastMessage = this.i18nService.t("archivedItemRestored");
|
||||
} else {
|
||||
toastMessage = this.i18nService.t("restoredItem");
|
||||
}
|
||||
|
||||
await this.router.navigate(["/trash"]);
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("restoredItem"),
|
||||
message: toastMessage,
|
||||
});
|
||||
} catch (e) {
|
||||
this.logService.error(e);
|
||||
|
||||
@@ -2092,6 +2092,9 @@
|
||||
"permanentlyDeletedItem": {
|
||||
"message": "Item permanently deleted"
|
||||
},
|
||||
"archivedItemRestored": {
|
||||
"message": "Archived item restored"
|
||||
},
|
||||
"restoredItem": {
|
||||
"message": "Item restored"
|
||||
},
|
||||
|
||||
@@ -173,16 +173,23 @@ export class ItemFooterComponent implements OnInit, OnChanges {
|
||||
}
|
||||
|
||||
async restore(): Promise<boolean> {
|
||||
let toastMessage;
|
||||
if (!this.cipher.isDeleted) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.cipher.isArchived) {
|
||||
toastMessage = this.i18nService.t("archivedItemRestored");
|
||||
} else {
|
||||
toastMessage = this.i18nService.t("restoredItem");
|
||||
}
|
||||
|
||||
try {
|
||||
const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
|
||||
await this.restoreCipher(activeUserId);
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
message: this.i18nService.t("restoredItem"),
|
||||
message: toastMessage,
|
||||
});
|
||||
this.onRestore.emit(this.cipher);
|
||||
} catch (e) {
|
||||
|
||||
@@ -1271,6 +1271,7 @@ export class VaultComponent<C extends CipherViewLike> implements OnInit, OnDestr
|
||||
}
|
||||
|
||||
restore = async (c: C): Promise<boolean> => {
|
||||
let toastMessage;
|
||||
if (!CipherViewLikeUtils.isDeleted(c)) {
|
||||
return;
|
||||
}
|
||||
@@ -1284,13 +1285,19 @@ export class VaultComponent<C extends CipherViewLike> implements OnInit, OnDestr
|
||||
return;
|
||||
}
|
||||
|
||||
if (CipherViewLikeUtils.isArchived(c)) {
|
||||
toastMessage = this.i18nService.t("archivedItemRestored");
|
||||
} else {
|
||||
toastMessage = this.i18nService.t("restoredItem");
|
||||
}
|
||||
|
||||
try {
|
||||
const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
|
||||
await this.cipherService.restoreWithServer(uuidAsString(c.id), activeUserId);
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("restoredItem"),
|
||||
message: toastMessage,
|
||||
});
|
||||
this.refresh();
|
||||
} catch (e) {
|
||||
@@ -1299,11 +1306,18 @@ export class VaultComponent<C extends CipherViewLike> implements OnInit, OnDestr
|
||||
};
|
||||
|
||||
async bulkRestore(ciphers: C[]) {
|
||||
let toastMessage;
|
||||
if (ciphers.some((c) => !c.edit)) {
|
||||
this.showMissingPermissionsError();
|
||||
return;
|
||||
}
|
||||
|
||||
if (ciphers.some((c) => !CipherViewLikeUtils.isArchived(c))) {
|
||||
toastMessage = this.i18nService.t("restoredItems");
|
||||
} else {
|
||||
toastMessage = this.i18nService.t("archivedItemsRestored");
|
||||
}
|
||||
|
||||
if (!(await this.repromptCipher(ciphers))) {
|
||||
return;
|
||||
}
|
||||
@@ -1323,7 +1337,7 @@ export class VaultComponent<C extends CipherViewLike> implements OnInit, OnDestr
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("restoredItems"),
|
||||
message: toastMessage,
|
||||
});
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
@@ -5418,6 +5418,12 @@
|
||||
"restoreSelected": {
|
||||
"message": "Restore selected"
|
||||
},
|
||||
"archivedItemRestored": {
|
||||
"message": "Archived item restored"
|
||||
},
|
||||
"archivedItemsRestored": {
|
||||
"message": "Archived items restored"
|
||||
},
|
||||
"restoredItem": {
|
||||
"message": "Item restored"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user