From 64d313c858c86a2874edb95f58c6e7a3411dfd2c Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Sun, 25 Sep 2022 16:09:08 -0700 Subject: [PATCH] Improve archive error display --- src/components/Timeline.vue | 6 +++++- src/services/DavRequests.ts | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/Timeline.vue b/src/components/Timeline.vue index 88971d29..b8d8e86d 100644 --- a/src/components/Timeline.vue +++ b/src/components/Timeline.vue @@ -1135,7 +1135,11 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) { try { this.loading++; - for await (const delIds of dav.archiveFilesByIds(Array.from(this.selection.keys()), !this.routeIsArchive())) { + for await (let delIds of dav.archiveFilesByIds(Array.from(this.selection.keys()), !this.routeIsArchive())) { + delIds = delIds.filter(x => x); + if (delIds.length === 0) { + continue + } const delPhotos = delIds.map(id => this.selection.get(id)); await this.deleteFromViewWithAnimation(delPhotos); } diff --git a/src/services/DavRequests.ts b/src/services/DavRequests.ts index 017c3312..005ad75c 100644 --- a/src/services/DavRequests.ts +++ b/src/services/DavRequests.ts @@ -245,8 +245,9 @@ export async function archiveFile(fileid: number, archive: boolean) { await archiveFile(id, archive); return id as number; } catch (error) { - console.error('Failed to archive', id, error); - showError(t('memories', 'Failed to archive some files.')); + console.error('Failed to (un)archive', id, error); + const msg = error?.response?.data?.message || t('memories', 'General Failure'); + showError(t('memories', 'Error: {msg}', { msg })); return 0; } });