From a2d31f9b591b5fa5859a8962fe09f34be77a3eed Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Wed, 11 Nov 2026 21:42:02 -0800 Subject: [PATCH] Only enabled! --- .../components/document-detail/document-detail.component.ts | 1 + .../document-list/bulk-editor/bulk-editor.component.ts | 1 + src/documents/filters.py | 1 + src/documents/serialisers.py | 2 ++ src/documents/tests/test_api_bulk_edit.py | 4 ++++ 5 files changed, 9 insertions(+) diff --git a/src-ui/src/app/components/document-detail/document-detail.component.ts b/src-ui/src/app/components/document-detail/document-detail.component.ts index 6dbf5c6ac8..e3516f4cad 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.ts +++ b/src-ui/src/app/components/document-detail/document-detail.component.ts @@ -851,6 +851,7 @@ export class DocumentDetailComponent this.workflowService .list(1, 100000, null, null, { trigger_type: WorkflowTriggerType.Manual, + enabled: true, }) .pipe(first(), takeUntil(this.unsubscribeNotifier)) .subscribe((result) => this.manualWorkflows.set(result.results)) 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 103e47a1fc..83156c1435 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 @@ -274,6 +274,7 @@ export class BulkEditorComponent this.workflowService .list(1, 100000, null, null, { trigger_type: WorkflowTriggerType.Manual, + enabled: true, }) .pipe(first()) .subscribe((result) => (this.manualWorkflows = result.results)) diff --git a/src/documents/filters.py b/src/documents/filters.py index 8f4e06db38..9c0b476c2c 100644 --- a/src/documents/filters.py +++ b/src/documents/filters.py @@ -258,6 +258,7 @@ class WorkflowFilterSet(FilterSet): model = Workflow fields = { "id": ID_KWARGS, + "enabled": ["exact"], } diff --git a/src/documents/serialisers.py b/src/documents/serialisers.py index fd65b11e0e..537db40d83 100644 --- a/src/documents/serialisers.py +++ b/src/documents/serialisers.py @@ -2167,6 +2167,8 @@ class BulkEditSerializer( workflow = Workflow.objects.get(id=parameters["workflow"]) except (Workflow.DoesNotExist, ValueError, TypeError): raise serializers.ValidationError("Workflow does not exist") + if not workflow.enabled: + raise serializers.ValidationError("Workflow is not enabled") if not workflow.triggers.filter( type=WorkflowTrigger.WorkflowTriggerType.MANUAL, ).exists(): diff --git a/src/documents/tests/test_api_bulk_edit.py b/src/documents/tests/test_api_bulk_edit.py index ef6f8267c0..10f9429a31 100644 --- a/src/documents/tests/test_api_bulk_edit.py +++ b/src/documents/tests/test_api_bulk_edit.py @@ -637,10 +637,14 @@ class TestBulkEditAPI(DirectoriesMixin, APITestCase): type=WorkflowTrigger.WorkflowTriggerType.DOCUMENT_ADDED, ), ) + disabled = self._make_manual_workflow() + disabled.enabled = False + disabled.save() for label, parameters in ( ("missing workflow", {}), ("nonexistent workflow", {"workflow": 9999}), ("no manual trigger", {"workflow": non_manual.id}), + ("disabled workflow", {"workflow": disabled.id}), ("non-bool filter", {"workflow": manual.id, "filter_documents": "nope"}), ): with self.subTest(label):