mirror of
https://github.com/discourse/discourse.git
synced 2026-08-14 13:58:53 +08:00
Discourse Workflows is a visual automation plugin for admins. A workflow is a versioned graph made of trigger, condition, action, and utility nodes. ## Architecture The plugin has three main responsibilities: - Store and version workflow graphs. - Render an admin editor from node metadata. - Execute published workflow versions and record their results. The graph is stored as workflow nodes plus connections. Each node has a stable type, a type version, editor position, configuration parameters, optional credential references, and direct runtime settings. Published workflows create immutable versions that executions can safely use even after the draft changes. ## Runtime Flow A normal execution follows this path: 1. A trigger produces initial data from a Discourse event, schedule, webhook, or manual run. 2. Trigger data is wrapped as workflow items. 3. The executor queues downstream nodes from the graph connections. 4. Each node receives input items and returns one array per output. 5. The executor records the step, stores node output for expressions, and routes each output array to connected downstream nodes. 6. The execution finishes, fails, or enters a waiting state. Waiting nodes persist enough execution context to resume later. Resume requests continue from the waiting node using the workflow snapshot saved with the execution, not the latest draft. Expressions are resolved at runtime against the current item, node parameters, workflow variables, previous node outputs, and execution context. The editor stores expression values in parameters; node code should read them through the execution context instead of parsing parameter values directly. ## Adding nodes - Workflow nodes, registered with `DiscoursePluginRegistry.register_discourse_workflows_node`. Core nodes live in `lib/discourse_workflows/nodes` and are registered during plugin initialization. Other plugins can add their own nodes when `DiscourseWorkflows` is loaded. ## Node API Nodes inherit from `DiscourseWorkflows::NodeType`. A node class is responsible for two things: - Declaring its contract with `description(...)`. - Implementing the runtime entry point for its node kind. The description is the public contract between the node, editor, validator, and runtime. It should include: - `name`: stable identifier, usually prefixed by `trigger:`, `action:`, `condition:`, or `flow:`. - `version`: implementation version used by stored workflow nodes. - `defaults`: editor metadata such as icon and color. - `group`: palette category. - `inputs` and `outputs`: graph ports. - `properties`: configuration fields rendered by the property engine. - `credentials`: credential slots the node can use. - `webhooks`: public or resume webhook declarations. - `events`: Discourse events that should activate a trigger node. - `capabilities`: feature flags such as manual triggering, waiting, or current user access. - `available`: optional availability gate for nodes backed by another plugin or site setting. Description data should stay declarative. Put business logic in the runtime entry point or helper classes. ### Action, Condition, And Flow Nodes Action-like nodes implement `execute(exec_ctx)`. They receive input items through the execution context and return positional output arrays. A one-output node returns one outer array; a branching node returns one inner array per branch. ### Trigger Nodes Trigger nodes start executions. Event triggers declare `events` and usually implement: - `valid?` to ignore events that should not run workflows. - `matches?(trigger_ctx)` to compare event data with node configuration. - `output` to produce the initial workflow item data. ### Webhook And Waiting Nodes Webhook trigger nodes declare webhook metadata and produce initial data from the incoming request. Waiting nodes pause an execution and resume it through a later interaction or webhook. ### Dynamic Options Nodes can provide dynamic property options with `self.load_options_context(context)`. Use the context object to access current parameters, filtered credentials, the search filter, the current user, guardian, and shared helpers. ### Errors And Logs Raise `DiscourseWorkflows::NodeError` for failures admins can act on, such as invalid configuration or missing Discourse records. Unexpected exceptions fail the current execution. --------- --------- Co-authored-by: Renato Atilio <3530+renato@users.noreply.github.com> Co-authored-by: Martin Brennan <martin@discourse.org> Co-authored-by: Jordan Vidrine <30537603+jordanvidrine@users.noreply.github.com>
107 lines
5.8 KiB
YAML
Vendored
107 lines
5.8 KiB
YAML
Vendored
en:
|
|
site_settings:
|
|
assign_enabled: "Enable the assign plugin"
|
|
assigns_public: "Allow general public to see topic assignments"
|
|
assigns_user_url_path: "Path to users assigned topics (use: {username} to substitute username)"
|
|
assigns_by_staff_mention: "If a staff member mentions another staff member, topic is automatically assigned"
|
|
unassign_creates_tracking_post: "If you unassign a topic a whisper or small action will be created to track change"
|
|
assign_self_regex: "Regex that needs to pass for self assign. Example 'my list'"
|
|
assign_other_regex: "Regex that needs to pass for assigning topics to others via mention. Example 'your list'."
|
|
unassign_on_group_archive: "When a message is archived by a group, unassign message (reassign if moved back to inbox)"
|
|
unassign_on_close: "Automatically unassign the topic when it is closed. NOTE: No tracking post will be created."
|
|
reassign_on_open: "When a topic is opened reassign previously assigned users/groups"
|
|
invite_on_assign: "When a personal message is assigned to a user or group, invite them to the PM if they are not already a participant."
|
|
assign_mailer: "When to send notification email for assignments"
|
|
remind_assigns: "Remind users about pending assigns."
|
|
remind_assigns_frequency: "Frequency for reminding users about assigned topics."
|
|
pending_assign_reminder_threshold: "Number of pending assignments that triggers a reminder notification."
|
|
max_assigned_topics: "Maximum number of topics that can be assigned to a user."
|
|
assign_allowed_on_groups: "Users in these groups are allowed to assign topics."
|
|
enable_assign_status: "Add a customizable status field to every assignment."
|
|
assign_statuses: "List of statuses available to each assignment. The first status is the default status applied to every new assignment."
|
|
ignore_solved_topics_in_assigned_reminder: "Prevent reminders for assignments from including solved topics. Only relevant when using the discourse-solved plugin."
|
|
assignment_status_on_solve: "When a topic is solved update all assignments to this status"
|
|
assignment_status_on_unsolve: "When a topic is unsolved update all assignments to this status"
|
|
errors:
|
|
assign_statuses:
|
|
too_few: "There must be at least two different statuses available."
|
|
duplicate: "There are duplicate status values."
|
|
removed_in_use: "Can't remove a status from the list if there are existing assignments using this status."
|
|
discourse_assign:
|
|
assigned_to: "Topic assigned to @%{username}"
|
|
unassigned: "Topic was unassigned"
|
|
filter:
|
|
description:
|
|
assigned: "Filter topics assigned to a specific user or group"
|
|
nobody: "Filter topics that are not assigned to anyone"
|
|
anyone: "Filter topics assigned to anyone"
|
|
already_claimed: "That topic has already been claimed."
|
|
already_assigned: "Topic is already assigned to @%{username}"
|
|
too_many_assigns: "@%{username} has already reached the maximum number of assigned topics (%{max})."
|
|
too_many_assigns_for_topic: "Limit of %{limit} assignments per topic has been reached."
|
|
forbidden_assign_to: "@%{username} can't be assigned since they don't belong to assigned allowed groups."
|
|
forbidden_assignee_not_pm_participant: "@%{username} can't be assigned because they don't have access to this PM. You can grant @%{username} access by inviting them to this PM."
|
|
forbidden_assignee_cant_see_topic: "@%{username} can't be assigned because they don't have access to this topic."
|
|
group_already_assigned: "Topic is already assigned to @%{group}"
|
|
forbidden_group_assign_to: "@%{group} can't be assigned since they don't belong to assigned allowed groups."
|
|
forbidden_group_assignee_not_pm_participant: "@%{group} can't be assigned because not all members have access to this PM."
|
|
forbidden_group_assignee_cant_see_topic: "@%{group} can't be assigned because not all members have access to this topic."
|
|
flag_assigned: "Sorry, that flag's topic is assigned to another user"
|
|
flag_unclaimed: "You must claim that topic before acting on the flag"
|
|
topic_assigned_excerpt: "assigned you the topic '%{title}'"
|
|
topic_group_assigned_excerpt: "assigned the topic '%{title}' to @%{group}"
|
|
reminders_frequency:
|
|
never: "never"
|
|
daily: "daily"
|
|
weekly: "weekly"
|
|
monthly: "monthly"
|
|
quarterly: "quarterly"
|
|
discourse_workflows:
|
|
assign_topic:
|
|
error: "Failed to assign topic: %{reason}"
|
|
assign_mailer:
|
|
title: "Assign Mailer"
|
|
subject_template: "[%{email_prefix}] %{assignee_name} assigned you to '%{topic_title}'!"
|
|
subject_template_improved: "%{email_prefix}: %{assignee_name} assigned you to '%{topic_title}'!"
|
|
text_body_template: |
|
|
Hey, %{assignee_name} **assigned** you to a discussion
|
|
> **%{topic_title}**
|
|
>
|
|
> %{topic_excerpt}
|
|
|
|
If you're interested, click the link below:
|
|
[%{topic_link}](%{topic_link})
|
|
pending_assigns_reminder:
|
|
title: "You have %{pending_assignments} pending assignments"
|
|
body: |
|
|
You currently have [%{pending_assignments} pending assignments](%{assignments_link}).
|
|
|
|
%{newest_assignments}
|
|
%{oldest_assignments}
|
|
|
|
This reminder will be sent %{frequency} if you have more than one assigned topic.
|
|
newest: |
|
|
### Newest
|
|
%{topic_0}
|
|
%{topic_1}
|
|
%{topic_2}
|
|
oldest: |
|
|
### Oldest
|
|
%{topic_0}
|
|
%{topic_1}
|
|
%{topic_2}
|
|
discourse_automation:
|
|
scriptables:
|
|
random_assign:
|
|
title: Random assign
|
|
no_one: "Attempted randomly assign a member of `@%{group}`, but no one was available."
|
|
discourse_push_notifications:
|
|
popup:
|
|
assigned: "@%{username} assigned you"
|
|
activerecord:
|
|
errors:
|
|
models:
|
|
assignment:
|
|
attributes:
|
|
status:
|
|
invalid: "Selected status is invalid (it is not included in the assigned_status site setting)."
|