Enhancement: "webui" workflowtrigger source option (#9170)

This commit is contained in:
shamoon
2025-02-21 08:26:00 -08:00
committed by GitHub
parent 3bf64ae7da
commit 4f08b5fa20
10 changed files with 95 additions and 25 deletions

View File

@@ -1,22 +0,0 @@
# Generated by Django 5.1.6 on 2025-02-16 16:31
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
("documents", "1062_alter_savedviewfilterrule_rule_type"),
]
operations = [
migrations.AlterField(
model_name="workflowactionwebhook",
name="url",
field=models.CharField(
help_text="The destination URL for the notification.",
max_length=256,
verbose_name="webhook url",
),
),
]

View File

@@ -0,0 +1,52 @@
# Generated by Django 5.1.6 on 2025-02-20 04:55
import multiselectfield.db.fields
from django.db import migrations
from django.db import models
# WebUI source was added, so all existing APIUpload sources should be updated to include WebUI
def update_workflow_sources(apps, schema_editor):
WorkflowTrigger = apps.get_model("documents", "WorkflowTrigger")
for trigger in WorkflowTrigger.objects.all():
sources = list(trigger.sources)
if 2 in sources:
sources.append(4)
trigger.sources = sources
trigger.save()
class Migration(migrations.Migration):
dependencies = [
("documents", "1062_alter_savedviewfilterrule_rule_type"),
]
operations = [
migrations.AlterField(
model_name="workflowactionwebhook",
name="url",
field=models.CharField(
help_text="The destination URL for the notification.",
max_length=256,
verbose_name="webhook url",
),
),
migrations.AlterField(
model_name="workflowtrigger",
name="sources",
field=multiselectfield.db.fields.MultiSelectField(
choices=[
(1, "Consume Folder"),
(2, "Api Upload"),
(3, "Mail Fetch"),
(4, "Web UI"),
],
default="1,2,3,4",
max_length=7,
),
),
migrations.RunPython(
code=update_workflow_sources,
reverse_code=migrations.RunPython.noop,
),
]