mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-12 17:20:48 +00:00
Only enabled!
This commit is contained in:
5 files changed
+9
No files matched your search
@@ -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))
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -258,6 +258,7 @@ class WorkflowFilterSet(FilterSet):
|
||||
model = Workflow
|
||||
fields = {
|
||||
"id": ID_KWARGS,
|
||||
"enabled": ["exact"],
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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():
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in new issue
Block a user