From 400da7bbc5f6175b27ec2a629379b6e4c4d56384 Mon Sep 17 00:00:00 2001 From: Michael Shamoon <4887959+nikonratm@users.noreply.github.com> Date: Sat, 19 Dec 2020 07:49:32 -0800 Subject: [PATCH] Minor refactoring --- .../bulk-editor/bulk-editor.component.ts | 4 ++-- .../document-list/document-list.component.ts | 12 +++--------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.ts b/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.ts index 8e6197e56..b1858e0f7 100644 --- a/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.ts +++ b/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.ts @@ -108,11 +108,11 @@ export class BulkEditorComponent { } applyCorrespondent(selectedCorrespondent: PaperlessCorrespondent[]) { - this.setCorrespondent.emit(selectedCorrespondent) + this.setCorrespondent.emit(selectedCorrespondent.length > 0 ? selectedCorrespondent.shift() : null) } applyDocumentType(selectedDocumentType: PaperlessDocumentType[]) { - this.setDocumentType.emit(selectedDocumentType) + this.setDocumentType.emit(selectedDocumentType.length > 0 ? selectedDocumentType.shift() : null) } applyDelete() { diff --git a/src-ui/src/app/components/document-list/document-list.component.ts b/src-ui/src/app/components/document-list/document-list.component.ts index 15e7987fe..a08cb1fad 100644 --- a/src-ui/src/app/components/document-list/document-list.component.ts +++ b/src-ui/src/app/components/document-list/document-list.component.ts @@ -142,10 +142,7 @@ export class DocumentListComponent implements OnInit { ) } - bulkSetCorrespondent(correspondent: PaperlessCorrespondent[]) { - if (correspondent.length > 0) correspondent = correspondent.shift() - else correspondent = undefined - + bulkSetCorrespondent(correspondent: PaperlessCorrespondent) { let modal = this.modalService.open(ConfirmDialogComponent, {backdrop: 'static'}) modal.componentInstance.title = "Confirm correspondent assignment" let messageFragment = correspondent ? `assign the correspondent ${correspondent.name} to` : `remove all correspondents from` @@ -161,10 +158,7 @@ export class DocumentListComponent implements OnInit { }) } - bulkSetDocumentType(documentType: PaperlessDocumentType[]) { - if (documentType.length > 0) documentType = documentType.shift() - else documentType = undefined - + bulkSetDocumentType(documentType: PaperlessDocumentType) { let modal = this.modalService.open(ConfirmDialogComponent, {backdrop: 'static'}) modal.componentInstance.title = "Confirm Document Type assignment" let messageFragment = documentType ? `assign the document type ${documentType.name} to` : `remove all document types from` @@ -182,7 +176,7 @@ export class DocumentListComponent implements OnInit { bulkSetTags(tags) { console.log('bulkSetTags', tags); - // TODO: + // TODO: } bulkAddTag() {