Skip to content

A platform for community discussion. Free, open, simple.

FEATURE: Add V2 plugin workflow nodes with consistent user and actor (#44558)

Régis Hanol0c502230f44a
diff --git a/plugins/boards/lib/discourse_workflows/nodes/boards_schema.rb b/plugins/boards/lib/discourse_workflows/nodes/boards_schema.rb
index 7f28efa2dd0..9a26d6c9444 100644
--- a/plugins/boards/lib/discourse_workflows/nodes/boards_schema.rb
+++ b/plugins/boards/lib/discourse_workflows/nodes/boards_schema.rb
@@ -80,6 +80,14 @@ if defined?(DiscourseWorkflows)
CARD_MOVED_SCHEMA,
ACTING_USER_SCHEMA,
)
+
+ CARD_MOVED_V2_OUTPUT_SCHEMA =
+ DiscourseWorkflows::Schema.merge(
+ CARD_SCHEMA,
+ BOARD_SCHEMA,
+ CARD_MOVED_SCHEMA,
+ DiscourseWorkflows::Schema::ACTOR_SCHEMA,
+ )
end
end
end
diff --git a/plugins/boards/lib/discourse_workflows/nodes/card_moved/v1.rb b/plugins/boards/lib/discourse_workflows/nodes/card_moved/v1.rb
index 2e31d9870b4..20c03561a35 100644
--- a/plugins/boards/lib/discourse_workflows/nodes/card_moved/v1.rb
+++ b/plugins/boards/lib/discourse_workflows/nodes/card_moved/v1.rb
@@ -41,6 +41,8 @@ if defined?(DiscourseWorkflows)
},
)
+ deprecated(superseded_by: "2.0", changes: { "acting_user" => "actor" })
+
def initialize(board, card_payload, acting_user, *)
super(parameters: {})
card_payload = card_payload.with_indifferent_access
diff --git a/plugins/boards/lib/discourse_workflows/nodes/card_moved/v2.rb b/plugins/boards/lib/discourse_workflows/nodes/card_moved/v2.rb
new file mode 100644
index 00000000000..9a2bbbefbbb
--- /dev/null
+++ b/plugins/boards/lib/discourse_workflows/nodes/card_moved/v2.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+if defined?(DiscourseWorkflows)
+ module DiscourseWorkflows
+ module Nodes
+ module CardMoved
+ class V2 < V1
+ description(
+ superclass.description.merge(
+ version: "2.0",
+ output_contracts: [{ schema: BoardsSchema::CARD_MOVED_V2_OUTPUT_SCHEMA }],
+ ),
+ )
+
+ def output
+ super.transform_keys(acting_user: :actor)
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/plugins/boards/plugin.rb b/plugins/boards/plugin.rb
index c77ac72685e..1a519a41245 100644
--- a/plugins/boards/plugin.rb
+++ b/plugins/boards/plugin.rb
@@ -30,10 +30,12 @@ after_initialize do
require_relative "lib/discourse_workflows/nodes/create_board/v1"
require_relative "lib/discourse_workflows/nodes/create_board_column/v1"
require_relative "lib/discourse_workflows/nodes/card_moved/v1"
+ require_relative "lib/discourse_workflows/nodes/card_moved/v2"
[
DiscourseWorkflows::Nodes::CreateBoard::V1,
DiscourseWorkflows::Nodes::CreateBoardColumn::V1,
DiscourseWorkflows::Nodes::CardMoved::V1,
+ DiscourseWorkflows::Nodes::CardMoved::V2,
]
end
end
diff --git a/plugins/boards/spec/lib/discourse_workflows/nodes/card_moved/v2_spec.rb b/plugins/boards/spec/lib/discourse_workflows/nodes/card_moved/v2_spec.rb
new file mode 100644
index 00000000000..e473532d734
--- /dev/null
+++ b/plugins/boards/spec/lib/discourse_workflows/nodes/card_moved/v2_spec.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+RSpec.describe DiscourseWorkflows::Nodes::CardMoved::V2 do
+ fab!(:manager, :user)
+ fab!(:board, :boards_board)
+ fab!(:old_column) { Fabricate(:boards_column, board:) }
+ fab!(:new_column) { Fabricate(:boards_column, board:) }
+ fab!(:card) { Fabricate(:boards_card, board:, column: new_column) }
+
+ before do
+ SiteSetting.enable_discourse_workflows = true
+ SiteSetting.boards_enabled = true
+ end
+
+ it "returns the user who moved the card as actor", :aggregate_failures do
+ trigger =
+ described_class.new(
+ board,
+ { id: card.id, old_column_id: old_column.id, column_id: new_column.id },
+ manager,
+ )
+
+ expect(trigger.output[:actor]).to include(id: manager.id, username: manager.username)
+ expect(trigger.output).not_to have_key(:acting_user)
+ expect(trigger.output).to match_node_output_schema(described_class)
+ end
+end
diff --git a/plugins/discourse-assign/lib/discourse_assign/workflows/schema.rb b/plugins/discourse-assign/lib/discourse_assign/workflows/schema.rb
index 5fe4bf10b67..43ca9653d05 100644
--- a/plugins/discourse-assign/lib/discourse_assign/workflows/schema.rb
+++ b/plugins/discourse-assign/lib/discourse_assign/workflows/schema.rb
@@ -71,6 +71,25 @@ module DiscourseAssign
ASSIGNMENT_SCHEMA,
DiscourseWorkflows::Schema::ACTOR_SCHEMA,
).freeze
+
+ ASSIGNMENT_V2_SCHEMA =
+ DiscourseWorkflows::Schema.document(
+ "assignment" => {
+ "type" => "object",
+ "properties" =>
+ ASSIGNMENT_SCHEMA.dig("properties", "assignment", "properties").transform_keys(
+ "assigned_by_user" => "assigned_by",
+ ),
+ },
+ )
+
+ ASSIGNMENT_V2_OUTPUT_SCHEMA =
+ DiscourseWorkflows::Schema.merge(
+ DiscourseWorkflows::Schema::POST_SCHEMA,
+ DiscourseWorkflows::Schema::TOPIC_LIST_ITEM_SCHEMA,
+ ASSIGNMENT_V2_SCHEMA,
+ DiscourseWorkflows::Schema::ACTOR_SCHEMA,
+ ).freeze
end
end
end
diff --git a/plugins/discourse-assign/lib/discourse_workflows/nodes/assigned/v1.rb b/plugins/discourse-assign/lib/discourse_workflows/nodes/assigned/v1.rb
index 6fefc6e33b2..b28b740a8ed 100644
--- a/plugins/discourse-assign/lib/discourse_workflows/nodes/assigned/v1.rb
+++ b/plugins/discourse-assign/lib/discourse_workflows/nodes/assigned/v1.rb
@@ -31,6 +31,13 @@ if defined?(DiscourseWorkflows)
},
},
)
+
+ deprecated(
+ superseded_by: "2.0",
+ changes: {
+ "assignment.assigned_by_user" => "assignment.assigned_by",
+ },
+ )
end
end
end
diff --git a/plugins/discourse-assign/lib/discourse_workflows/nodes/assigned/v2.rb b/plugins/discourse-assign/lib/discourse_workflows/nodes/assigned/v2.rb
new file mode 100644
index 00000000000..4202ead4998
--- /dev/null
+++ b/plugins/discourse-assign/lib/discourse_workflows/nodes/assigned/v2.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+if defined?(DiscourseWorkflows)
+ module DiscourseWorkflows
+ module Nodes
+ module Assigned
+ class V2 < V1
+ description(
+ superclass.description.merge(
+ version: "2.0",
+ output_contracts: [
+ { schema: DiscourseAssign::Workflows::Schema::ASSIGNMENT_V2_OUTPUT_SCHEMA },
+ ],
+ ),
+ )
+
+ def output
+ super.then do |data|
+ data.merge(
+ assignment: data[:assignment].transform_keys(assigned_by_user: :assigned_by),
+ )
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/plugins/discourse-assign/lib/discourse_workflows/nodes/unassigned/v1.rb b/plugins/discourse-assign/lib/discourse_workflows/nodes/unassigned/v1.rb
index d2934471ecd..343704aabbf 100644
--- a/plugins/discourse-assign/lib/discourse_workflows/nodes/unassigned/v1.rb
+++ b/plugins/discourse-assign/lib/discourse_workflows/nodes/unassigned/v1.rb
@@ -31,6 +31,13 @@ if defined?(DiscourseWorkflows)
},
},
)
+
+ deprecated(
+ superseded_by: "2.0",
+ changes: {
+ "assignment.assigned_by_user" => "assignment.assigned_by",
+ },
+ )
end
end
end
diff --git a/plugins/discourse-assign/lib/discourse_workflows/nodes/unassigned/v2.rb b/plugins/discourse-assign/lib/discourse_workflows/nodes/unassigned/v2.rb
new file mode 100644
index 00000000000..c9faace46d5
--- /dev/null
+++ b/plugins/discourse-assign/lib/discourse_workflows/nodes/unassigned/v2.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+if defined?(DiscourseWorkflows)
+ module DiscourseWorkflows
+ module Nodes
+ module Unassigned
+ class V2 < V1
+ description(
+ superclass.description.merge(
+ version: "2.0",
+ output_contracts: [
+ { schema: DiscourseAssign::Workflows::Schema::ASSIGNMENT_V2_OUTPUT_SCHEMA },
+ ],
+ ),
+ )
+
+ def output
+ super.then do |data|
+ data.merge(
+ assignment: data[:assignment].transform_keys(assigned_by_user: :assigned_by),
+ )
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/plugins/discourse-assign/plugin.rb b/plugins/discourse-assign/plugin.rb
index 4b85d6a52e4..a251c2b5e5f 100644
--- a/plugins/discourse-assign/plugin.rb
+++ b/plugins/discourse-assign/plugin.rb
@@ -30,7 +30,9 @@ after_initialize do
[
DiscourseWorkflows::Nodes::AssignTopic::V1,
DiscourseWorkflows::Nodes::Assigned::V1,
+ DiscourseWorkflows::Nodes::Assigned::V2,
DiscourseWorkflows::Nodes::Unassigned::V1,
+ DiscourseWorkflows::Nodes::Unassigned::V2,
DiscourseWorkflows::Nodes::CheckAssignment::V1,
]
end
diff --git a/plugins/discourse-assign/spec/lib/discourse_workflows/nodes/assigned/v2_spec.rb b/plugins/discourse-assign/spec/lib/discourse_workflows/nodes/assigned/v2_spec.rb
new file mode 100644
index 00000000000..2e00d79f988
--- /dev/null
+++ b/plugins/discourse-assign/spec/lib/discourse_workflows/nodes/assigned/v2_spec.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+RSpec.describe DiscourseWorkflows::Nodes::Assigned::V2 do
+ fab!(:topic)
+ fab!(:assigned_by_user, :admin)
+ fab!(:assignee, :moderator)
+
+ before do
+ SiteSetting.assign_enabled = true
+ SiteSetting.enable_discourse_workflows = true
+ Fabricate(:post, topic:)
+ end
+
+ it "returns the assigner as actor and assigned_by", :aggregate_failures do
+ event =
+ DiscourseEvent.track(:assigned) { Assigner.new(topic, assigned_by_user).assign(assignee) }
+ output = described_class.from_event(:assigned, *event[:params]).output
+
+ expect(output[:actor][:username]).to eq(assigned_by_user.username)
+ expect(output[:assignment][:assigned_by][:username]).to eq(assigned_by_user.username)
+ expect(output[:assignment]).not_to have_key(:assigned_by_user)
+ expect(output).to match_node_output_schema(described_class)
+ end
+end
diff --git a/plugins/discourse-assign/spec/lib/discourse_workflows/nodes/unassigned/v2_spec.rb b/plugins/discourse-assign/spec/lib/discourse_workflows/nodes/unassigned/v2_spec.rb
new file mode 100644
index 00000000000..3278bff1388
--- /dev/null
+++ b/plugins/discourse-assign/spec/lib/discourse_workflows/nodes/unassigned/v2_spec.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+RSpec.describe DiscourseWorkflows::Nodes::Unassigned::V2 do
+ fab!(:topic)
+ fab!(:assigned_by_user, :admin)
+ fab!(:unassigned_by_user, :admin)
+ fab!(:assignee, :moderator)
+
+ before do
+ SiteSetting.assign_enabled = true
+ SiteSetting.enable_discourse_workflows = true
+ Fabricate(:post, topic:)
+ end
+
+ it "returns the original assigner in assigned_by", :aggregate_failures do
+ Assigner.new(topic, assigned_by_user).assign(assignee)
+
+ event = DiscourseEvent.track(:unassigned) { Assigner.new(topic, unassigned_by_user).unassign }
+ output = described_class.from_event(:unassigned, *event[:params]).output
+
+ expect(output[:assignment][:assigned_by][:username]).to eq(assigned_by_user.username)
+ expect(output[:assignment]).not_to have_key(:assigned_by_user)
+ expect(output).to match_node_output_schema(described_class)
+ end
+end
diff --git a/plugins/discourse-reactions/config/locales/client.en.yml b/plugins/discourse-reactions/config/locales/client.en.yml
index e3e1327163a..5a4e58ff6fd 100644
--- a/plugins/discourse-reactions/config/locales/client.en.yml
+++ b/plugins/discourse-reactions/config/locales/client.en.yml
@@ -35,7 +35,8 @@ en:
"trigger:post_reaction_changed": "Post reaction changed"
node_descriptions:
"action:post_reaction": "Add or remove a reaction on a post"
- "trigger:post_reaction_changed": "Fires when a reaction on a post is added, replaced or removed. The user is whoever reacted, not the author."
+ "trigger:post_reaction_changed": "Fires when a reaction on a post is added, replaced or removed. The user is the author; the actor is whoever reacted."
+ "trigger:post_reaction_changed_v1": "Fires when a reaction on a post is added, replaced or removed. The user is whoever reacted, not the author."
post_reaction:
operations:
add: "Add reaction"
diff --git a/plugins/discourse-reactions/lib/discourse_workflows/nodes/post_reaction_changed/v1.rb b/plugins/discourse-reactions/lib/discourse_workflows/nodes/post_reaction_changed/v1.rb
index b8883cb0f35..9c01c0f574e 100644
--- a/plugins/discourse-reactions/lib/discourse_workflows/nodes/post_reaction_changed/v1.rb
+++ b/plugins/discourse-reactions/lib/discourse_workflows/nodes/post_reaction_changed/v1.rb
@@ -54,6 +54,16 @@ if defined?(DiscourseWorkflows)
},
)
+ deprecated(
+ superseded_by: "2.0",
+ changes: {
+ "user" => "actor",
+ },
+ notice_key: "discourse_workflows.node_deprecated.user_is_post_author",
+ description_key:
+ "discourse_workflows.node_descriptions.trigger:post_reaction_changed_v1",
+ )
+
def initialize(post, user, previous_reaction)
super(parameters: {})
@post = post
diff --git a/plugins/discourse-reactions/lib/discourse_workflows/nodes/post_reaction_changed/v2.rb b/plugins/discourse-reactions/lib/discourse_workflows/nodes/post_reaction_changed/v2.rb
new file mode 100644
index 00000000000..6f41f6e10cd
--- /dev/null
+++ b/plugins/discourse-reactions/lib/discourse_workflows/nodes/post_reaction_changed/v2.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+if defined?(DiscourseWorkflows)
+ module DiscourseWorkflows
+ module Nodes
+ module PostReactionChanged
+ class V2 < V1
+ V2_OUTPUT_SCHEMA =
+ Schema.merge(OUTPUT_SCHEMA, Schema::POST_AUTHOR_SCHEMA, Schema::ACTOR_SCHEMA).freeze
+
+ description(
+ superclass.description.merge(
+ version: "2.0",
+ output_contracts: [{ schema: V2_OUTPUT_SCHEMA }],
+ ),
+ )
+
+ def output
+ super.then { |data| data.merge(user: serialize_user(@post.user), actor: data[:user]) }
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/plugins/discourse-reactions/plugin.rb b/plugins/discourse-reactions/plugin.rb
index c1c497059d7..8f050b616e0 100644
--- a/plugins/discourse-reactions/plugin.rb
+++ b/plugins/discourse-reactions/plugin.rb
@@ -33,6 +33,7 @@ after_initialize do
[
DiscourseWorkflows::Nodes::PostReaction::V1,
DiscourseWorkflows::Nodes::PostReactionChanged::V1,
+ DiscourseWorkflows::Nodes::PostReactionChanged::V2,
]
end
end
diff --git a/plugins/discourse-reactions/spec/lib/discourse_workflows/nodes/post_reaction_changed_v2_spec.rb b/plugins/discourse-reactions/spec/lib/discourse_workflows/nodes/post_reaction_changed_v2_spec.rb
new file mode 100644
index 00000000000..9c1bbbf4366
--- /dev/null
+++ b/plugins/discourse-reactions/spec/lib/discourse_workflows/nodes/post_reaction_changed_v2_spec.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+RSpec.describe DiscourseWorkflows::Nodes::PostReactionChanged::V2, discourse_workflows: true do
+ fab!(:author, :user)
+ fab!(:post) { Fabricate(:post, user: author) }
+ fab!(:reactor, :user)
+
+ before do
+ SiteSetting.discourse_reactions_enabled = true
+ SiteSetting.discourse_reactions_enabled_reactions = "laughing|hugs"
+ end
+
+ it "returns the reactor as actor and the post author as user", :aggregate_failures do
+ DiscourseReactions::ReactionManager.new(reaction_value: "hugs", user: reactor, post:).toggle!
+ trigger = described_class.new(post, reactor, nil)
+
+ expect(trigger.output[:actor][:username]).to eq(reactor.username)
+ expect(trigger.output[:user][:username]).to eq(author.username)
+ expect(trigger.output).to match_node_output_schema(described_class)
+ end
+end
diff --git a/plugins/discourse-topic-voting/lib/discourse_topic_voting/workflows/schema.rb b/plugins/discourse-topic-voting/lib/discourse_topic_voting/workflows/schema.rb
index 6e86f4554f6..c59ad9bf882 100644
--- a/plugins/discourse-topic-voting/lib/discourse_topic_voting/workflows/schema.rb
+++ b/plugins/discourse-topic-voting/lib/discourse_topic_voting/workflows/schema.rb
@@ -22,6 +22,13 @@ module DiscourseTopicVoting
DiscourseWorkflows::Schema::USER_SCHEMA,
VOTE_SCHEMA,
).freeze
+
+ TOPIC_RECEIVED_VOTE_V2_OUTPUT_SCHEMA =
+ DiscourseWorkflows::Schema.merge(
+ TOPIC_RECEIVED_VOTE_OUTPUT_SCHEMA,
+ DiscourseWorkflows::Schema::TOPIC_AUTHOR_SCHEMA,
+ DiscourseWorkflows::Schema::ACTOR_SCHEMA,
+ ).freeze
end
end
end
diff --git a/plugins/discourse-topic-voting/lib/discourse_workflows/nodes/topic_received_vote/v1.rb b/plugins/discourse-topic-voting/lib/discourse_workflows/nodes/topic_received_vote/v1.rb
index 4607847bc2b..42354359cfd 100644
--- a/plugins/discourse-topic-voting/lib/discourse_workflows/nodes/topic_received_vote/v1.rb
+++ b/plugins/discourse-topic-voting/lib/discourse_workflows/nodes/topic_received_vote/v1.rb
@@ -26,6 +26,14 @@ if defined?(DiscourseWorkflows)
},
)
+ deprecated(
+ superseded_by: "2.0",
+ changes: {
+ "user" => "actor",
+ },
+ notice_key: "discourse_workflows.node_deprecated.user_is_topic_author",
+ )
+
def initialize(vote, *)
super(parameters: {})
@vote = vote
diff --git a/plugins/discourse-topic-voting/lib/discourse_workflows/nodes/topic_received_vote/v2.rb b/plugins/discourse-topic-voting/lib/discourse_workflows/nodes/topic_received_vote/v2.rb
new file mode 100644
index 00000000000..39051f65fe7
--- /dev/null
+++ b/plugins/discourse-topic-voting/lib/discourse_workflows/nodes/topic_received_vote/v2.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+if defined?(DiscourseWorkflows)
+ module DiscourseWorkflows
+ module Nodes
+ module TopicReceivedVote
+ class V2 < V1
+ description(
+ superclass.description.merge(
+ version: "2.0",
+ output_contracts: [
+ {
+ schema:
+ DiscourseTopicVoting::Workflows::Schema::TOPIC_RECEIVED_VOTE_V2_OUTPUT_SCHEMA,
+ },
+ ],
+ ),
+ )
+
+ def output
+ super.then { |data| data.merge(user: serialize_user(topic.user), actor: data[:user]) }
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/plugins/discourse-topic-voting/plugin.rb b/plugins/discourse-topic-voting/plugin.rb
index 04f770f885d..092e2b48428 100755
--- a/plugins/discourse-topic-voting/plugin.rb
+++ b/plugins/discourse-topic-voting/plugin.rb
@@ -35,7 +35,12 @@ after_initialize do
SeedFu.fixture_paths << Rails.root.join("plugins/discourse-topic-voting/db/fixtures").to_s
if respond_to?(:register_discourse_workflows_node)
- register_discourse_workflows_node { DiscourseWorkflows::Nodes::TopicReceivedVote::V1 }
+ register_discourse_workflows_node do
+ [
+ DiscourseWorkflows::Nodes::TopicReceivedVote::V1,
+ DiscourseWorkflows::Nodes::TopicReceivedVote::V2,
+ ]
+ end
end
reloadable_patch do
diff --git a/plugins/discourse-topic-voting/spec/lib/discourse_workflows/nodes/topic_received_vote/v2_spec.rb b/plugins/discourse-topic-voting/spec/lib/discourse_workflows/nodes/topic_received_vote/v2_spec.rb
new file mode 100644
index 00000000000..bce58c4bb1c
--- /dev/null
+++ b/plugins/discourse-topic-voting/spec/lib/discourse_workflows/nodes/topic_received_vote/v2_spec.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+RSpec.describe DiscourseWorkflows::Nodes::TopicReceivedVote::V2 do
+ fab!(:voter, :user)
+ fab!(:author, :user)
+ fab!(:category)
+ fab!(:topic) { Fabricate(:topic, category:, user: author) }
+ fab!(:vote) { Fabricate(:topic_voting_votes, user: voter, topic:) }
+
+ before do
+ SiteSetting.topic_voting_enabled = true
+ SiteSetting.enable_discourse_workflows = true
+ DiscourseTopicVoting::CategorySetting.create!(category:)
+ Category.reset_voting_cache
+ topic.update_vote_count
+ end
+
+ it "returns the voter as actor and the topic author as user", :aggregate_failures do
+ output = described_class.new(vote).output
+
+ expect(output[:actor][:username]).to eq(voter.username)
+ expect(output[:user][:username]).to eq(author.username)
+ expect(output).to match_node_output_schema(described_class)
+ end
+end
diff --git a/plugins/discourse-workflows/USE_CASES.md b/plugins/discourse-workflows/USE_CASES.md
index 468b79edf74..50d0c68046d 100644
--- a/plugins/discourse-workflows/USE_CASES.md
+++ b/plugins/discourse-workflows/USE_CASES.md
@@ -81,6 +81,7 @@ For each run, record:
- Deleting a post is `action:post` with `operation: delete`; `action:flag_post` with `review_delete` is for moderation flows that also need a reviewable. Restoring one is `operation: recover`.
- Flag post reasons and Flag user notes name the nearest AI Agent on the item's executed input path. Conditions preserve that attribution; merged inputs from different Agents or incomplete item links retain Workflow-only attribution. Successful flags persist the attributed Agent ID in a dedicated reviewable-to-agent table, making that Agent available in the Review Queue Reason filter without parsing reviewable content. Agent filtering survives renames and preserves Workflow filtering and score deduplication. Ambiguous or skipped flags do not add an Agent. Existing payload attribution is backfilled only for reviewables with Workflow score provenance; historical data does not establish individual Workflow–Agent pairings.
- `trigger:post_destroyed` and `trigger:post_recovered` expose the post author as `$json.user` and whoever deleted or restored it as `$json.actor`.
+- `$json.user` is the subject (author, affected account) and `$json.actor` whoever acted. Version `2.0` of `trigger:post_edited` (`editor` → `actor`), `trigger:post_like_changed`, `trigger:post_reaction_changed`, `trigger:topic_received_vote` (liker/reactor/voter → `actor`), `trigger:card_moved` (`acting_user` → `actor`), `trigger:assigned`/`trigger:unassigned` (`assignment.assigned_by_user` → `assignment.assigned_by`) and `action:post_like` (`username` → `actor`) apply this; version `1.0` keeps the old keys and is deprecated.
- DM/personal-message notifications should use `action:send_personal_message` instead of chat or topic reply nodes. Only an explicit chat DM uses `action:send_chat_message` with `target: "user"` (or `"group"` for one group DM).
- Forum `search`/`read` should not be used for node/schema discovery; use `workflow_node_catalog` and `workflow_validate_patch`.
diff --git a/plugins/discourse-workflows/config/locales/client.en.yml b/plugins/discourse-workflows/config/locales/client.en.yml
index 59beb588298..7b8278d2526 100644
--- a/plugins/discourse-workflows/config/locales/client.en.yml
+++ b/plugins/discourse-workflows/config/locales/client.en.yml
@@ -58,6 +58,7 @@ en:
notice: "A newer version of this node is available. Its output changes: %{changes}. Expressions using the old keys must be updated after upgrading."
upgrade: "Upgrade"
user_is_post_author: "In the newer version, user is the post author instead of whoever acted."
+ user_is_topic_author: "In the newer version, user is the topic author instead of whoever acted."
topic_v1: "Posts now use a smaller shape: author details such as trust_level, name, avatar_template, admin and staff moved to user, and fields such as topic_archetype, wiki, hidden, edit_reason and reads were removed."
node_issues:
title: "Configuration issues"
diff --git a/plugins/discourse-workflows/spec/lib/discourse_workflows/node_deprecation_spec.rb b/plugins/discourse-workflows/spec/lib/discourse_workflows/node_deprecation_spec.rb
index b975a366f17..2212efd4ea2 100644
--- a/plugins/discourse-workflows/spec/lib/discourse_workflows/node_deprecation_spec.rb
+++ b/plugins/discourse-workflows/spec/lib/discourse_workflows/node_deprecation_spec.rb
@@ -7,12 +7,17 @@ RSpec.describe DiscourseWorkflows::NodeType do
DiscourseWorkflows::Registry.nodes(include_disabled_plugins: true).select(&:deprecated?)
expect(deprecated.map(&:name)).to contain_exactly(
+ "DiscourseWorkflows::Nodes::Assigned::V1",
+ "DiscourseWorkflows::Nodes::CardMoved::V1",
"DiscourseWorkflows::Nodes::PostDestroyed::V1",
"DiscourseWorkflows::Nodes::PostEdited::V1",
"DiscourseWorkflows::Nodes::PostLike::V1",
"DiscourseWorkflows::Nodes::PostLikeChanged::V1",
+ "DiscourseWorkflows::Nodes::PostReactionChanged::V1",
"DiscourseWorkflows::Nodes::PostRecovered::V1",
"DiscourseWorkflows::Nodes::Topic::V1",
+ "DiscourseWorkflows::Nodes::TopicReceivedVote::V1",
+ "DiscourseWorkflows::Nodes::Unassigned::V1",
)
end