mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-14 18:12:44 +00:00
Fix: dont expect task ID for manual WF run in bulk dialog (#14763)
This commit is contained in:
1 parent
e746e008a0
commit
fc8c4e91ec
2 files changed
+25
-5
No files matched your search
@@ -686,6 +686,8 @@ describe('BulkEditorComponent', () => {
|
||||
})
|
||||
|
||||
it('should run a workflow on the selection via the run workflow dialog', () => {
|
||||
const toast = jest.spyOn(toastService, 'show')
|
||||
const infoToast = jest.spyOn(toastService, 'showInfo')
|
||||
let modal: NgbModalRef
|
||||
modalService.activeInstances.subscribe((m) => (modal = m[0]))
|
||||
jest.spyOn(permissionsService, 'currentUserCan').mockReturnValue(true)
|
||||
@@ -712,7 +714,12 @@ describe('BulkEditorComponent', () => {
|
||||
workflow: 5,
|
||||
filter_documents: false,
|
||||
})
|
||||
req.flush(true)
|
||||
req.flush({ result: 'OK' })
|
||||
expect(infoToast).toHaveBeenCalledWith(
|
||||
'Workflow will run on the selected documents in the background.'
|
||||
)
|
||||
expect(toast.mock.calls.at(-1)[0].actionName).toBeUndefined()
|
||||
expect(documentListViewService.selected.size).toBe(0)
|
||||
httpTestingController.match(
|
||||
`${environment.apiBaseUrl}documents/?page=1&page_size=50&ordering=-created&truncate_content=true&include_selection_data=true`
|
||||
) // list reload
|
||||
|
||||
@@ -322,10 +322,23 @@ export class BulkEditorComponent
|
||||
modal.componentInstance.confirmClicked
|
||||
.pipe(takeUntil(this.unsubscribeNotifier))
|
||||
.subscribe(() => {
|
||||
this.executeBulkEditMethod(modal, 'run_workflow', {
|
||||
workflow: modal.componentInstance.workflowId,
|
||||
filter_documents: !modal.componentInstance.force,
|
||||
})
|
||||
modal.componentInstance.buttonsEnabled.set(false)
|
||||
this.documentService
|
||||
.bulkEdit(this.getSelectionQuery(), 'run_workflow', {
|
||||
workflow: modal.componentInstance.workflowId,
|
||||
filter_documents: !modal.componentInstance.force,
|
||||
})
|
||||
.pipe(first())
|
||||
.subscribe({
|
||||
next: () => {
|
||||
modal.close()
|
||||
this.list.selectNone()
|
||||
this.toastService.showInfo(
|
||||
$localize`Workflow will run on the selected documents in the background.`
|
||||
)
|
||||
},
|
||||
error: (error) => this.handleOperationError(modal, error),
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user