A platform for community discussion. Free, open, simple.
DEV: Extract a shared `actor_property` for workflow nodes
Régis Hanolae59b748164e
diff --git a/plugins/boards/lib/discourse_workflows/nodes/create_board/v1.rb b/plugins/boards/lib/discourse_workflows/nodes/create_board/v1.rbindex ee558106989..7116c5ace78 100644--- a/plugins/boards/lib/discourse_workflows/nodes/create_board/v1.rb+++ b/plugins/boards/lib/discourse_workflows/nodes/create_board/v1.rb@@ -54,17 +54,7 @@ if defined?(DiscourseWorkflows)multiple: true,},},- actor_username: {- type: :string,- required: false,- default: "system",- ui: {- control: :actor,- },- control_options: {- allow_anonymous: false,- },- },+ **actor_property(allow_anonymous: false),},)diff --git a/plugins/boards/lib/discourse_workflows/nodes/create_board_column/v1.rb b/plugins/boards/lib/discourse_workflows/nodes/create_board_column/v1.rbindex bf901f131fc..84a592335d5 100644--- a/plugins/boards/lib/discourse_workflows/nodes/create_board_column/v1.rb+++ b/plugins/boards/lib/discourse_workflows/nodes/create_board_column/v1.rb@@ -72,17 +72,7 @@ if defined?(DiscourseWorkflows)options: %w[priority recency],default: "priority",},- actor_username: {- type: :string,- required: false,- default: "system",- ui: {- control: :actor,- },- control_options: {- allow_anonymous: false,- },- },+ **actor_property(allow_anonymous: false),},)diff --git a/plugins/discourse-workflows/lib/discourse_workflows/node_type.rb b/plugins/discourse-workflows/lib/discourse_workflows/node_type.rbindex 30915882b0f..19d2c9ba11d 100644--- a/plugins/discourse-workflows/lib/discourse_workflows/node_type.rb+++ b/plugins/discourse-workflows/lib/discourse_workflows/node_type.rb@@ -50,6 +50,12 @@ module DiscourseWorkflows},}.freeze+ def self.actor_property(allow_anonymous: true, **options)+ property = { type: :string, required: false, default: "system", ui: { control: :actor } }+ property[:control_options] = { allow_anonymous: false } if !allow_anonymous+ { actor_username: property.merge(options) }+ end+DESCRIPTION_DEFAULTS = {version: "1.0",defaults: {diff --git a/plugins/discourse-workflows/lib/discourse_workflows/nodes/badge/v1.rb b/plugins/discourse-workflows/lib/discourse_workflows/nodes/badge/v1.rbindex 01fe0208e6e..74a77cfe4b2 100644--- a/plugins/discourse-workflows/lib/discourse_workflows/nodes/badge/v1.rb+++ b/plugins/discourse-workflows/lib/discourse_workflows/nodes/badge/v1.rb@@ -70,14 +70,7 @@ module DiscourseWorkflowsnone: "discourse_workflows.badge.badge_id_placeholder",},},- actor_username: {- type: :string,- required: false,- default: "system",- ui: {- control: :actor,- },- },+ **actor_property,},)diff --git a/plugins/discourse-workflows/lib/discourse_workflows/nodes/flag_post/v1.rb b/plugins/discourse-workflows/lib/discourse_workflows/nodes/flag_post/v1.rbindex 247ebbb7acf..5078ff49c6c 100644--- a/plugins/discourse-workflows/lib/discourse_workflows/nodes/flag_post/v1.rb+++ b/plugins/discourse-workflows/lib/discourse_workflows/nodes/flag_post/v1.rb@@ -74,14 +74,7 @@ module DiscourseWorkflowscontrol: :textarea,},},- actor_username: {- type: :string,- required: false,- default: "system",- ui: {- control: :actor,- },- },+ **actor_property,},)diff --git a/plugins/discourse-workflows/lib/discourse_workflows/nodes/flag_user/v1.rb b/plugins/discourse-workflows/lib/discourse_workflows/nodes/flag_user/v1.rbindex 8ba0ab2f83a..39e81a69e6c 100644--- a/plugins/discourse-workflows/lib/discourse_workflows/nodes/flag_user/v1.rb+++ b/plugins/discourse-workflows/lib/discourse_workflows/nodes/flag_user/v1.rb@@ -74,14 +74,7 @@ module DiscourseWorkflowsexpression: true,},},- actor_username: {- type: :string,- required: false,- default: "system",- ui: {- control: :actor,- },- },+ **actor_property,},)diff --git a/plugins/discourse-workflows/lib/discourse_workflows/nodes/group/v1.rb b/plugins/discourse-workflows/lib/discourse_workflows/nodes/group/v1.rbindex 6759ad54f0b..653cf46754c 100644--- a/plugins/discourse-workflows/lib/discourse_workflows/nodes/group/v1.rb+++ b/plugins/discourse-workflows/lib/discourse_workflows/nodes/group/v1.rb@@ -92,14 +92,7 @@ module DiscourseWorkflows},},},- actor_username: {- type: :string,- required: false,- default: "system",- ui: {- control: :actor,- },- },+ **actor_property,},)diff --git a/plugins/discourse-workflows/lib/discourse_workflows/nodes/post/v1.rb b/plugins/discourse-workflows/lib/discourse_workflows/nodes/post/v1.rbindex 68f92eea5c7..455f3a11f1f 100644--- a/plugins/discourse-workflows/lib/discourse_workflows/nodes/post/v1.rb+++ b/plugins/discourse-workflows/lib/discourse_workflows/nodes/post/v1.rb@@ -318,19 +318,7 @@ module DiscourseWorkflows},},},- actor_username: {- type: :string,- required: false,- default: "system",- ui: {- control: :actor,- },- display_options: {- show: {- operation: %w[get list delete recover],- },- },- },+ **actor_property(display_options: { show: { operation: %w[get list delete recover] } }),},)diff --git a/plugins/discourse-workflows/lib/discourse_workflows/nodes/site_setting_update/v1.rb b/plugins/discourse-workflows/lib/discourse_workflows/nodes/site_setting_update/v1.rbindex f8ab7469b92..bc2ccce2245 100644--- a/plugins/discourse-workflows/lib/discourse_workflows/nodes/site_setting_update/v1.rb+++ b/plugins/discourse-workflows/lib/discourse_workflows/nodes/site_setting_update/v1.rb@@ -59,14 +59,7 @@ module DiscourseWorkflowsrequired: false,default: "",},- actor_username: {- type: :string,- required: false,- default: "system",- ui: {- control: :actor,- },- },+ **actor_property,},)diff --git a/plugins/discourse-workflows/lib/discourse_workflows/nodes/tag_group/v1.rb b/plugins/discourse-workflows/lib/discourse_workflows/nodes/tag_group/v1.rbindex 5b322f65125..4fbaeade56b 100644--- a/plugins/discourse-workflows/lib/discourse_workflows/nodes/tag_group/v1.rb+++ b/plugins/discourse-workflows/lib/discourse_workflows/nodes/tag_group/v1.rb@@ -73,14 +73,7 @@ module DiscourseWorkflowscontrol: :tags,},},- actor_username: {- type: :string,- required: false,- default: "system",- ui: {- control: :actor,- },- },+ **actor_property,},)diff --git a/plugins/discourse-workflows/lib/discourse_workflows/nodes/topic/v1.rb b/plugins/discourse-workflows/lib/discourse_workflows/nodes/topic/v1.rbindex 4ace230f293..fc0e6cc6597 100644--- a/plugins/discourse-workflows/lib/discourse_workflows/nodes/topic/v1.rb+++ b/plugins/discourse-workflows/lib/discourse_workflows/nodes/topic/v1.rb@@ -192,14 +192,7 @@ module DiscourseWorkflows},},},- actor_username: {- type: :string,- required: false,- default: "system",- ui: {- control: :actor,- },- },+ **actor_property,},)diff --git a/plugins/discourse-workflows/lib/discourse_workflows/nodes/topic_category/v1.rb b/plugins/discourse-workflows/lib/discourse_workflows/nodes/topic_category/v1.rbindex 5836a7f4112..37373172d20 100644--- a/plugins/discourse-workflows/lib/discourse_workflows/nodes/topic_category/v1.rb+++ b/plugins/discourse-workflows/lib/discourse_workflows/nodes/topic_category/v1.rb@@ -46,14 +46,7 @@ module DiscourseWorkflowscontrol: :category,},},- actor_username: {- type: :string,- required: false,- default: "system",- ui: {- control: :actor,- },- },+ **actor_property,},)diff --git a/plugins/discourse-workflows/lib/discourse_workflows/nodes/topic_moderation/v1.rb b/plugins/discourse-workflows/lib/discourse_workflows/nodes/topic_moderation/v1.rbindex efe665916bd..a19c0483d4d 100644--- a/plugins/discourse-workflows/lib/discourse_workflows/nodes/topic_moderation/v1.rb+++ b/plugins/discourse-workflows/lib/discourse_workflows/nodes/topic_moderation/v1.rb@@ -32,14 +32,7 @@ module DiscourseWorkflowstype: :string,required: true,},- actor_username: {- type: :string,- required: false,- default: "system",- ui: {- control: :actor,- },- },+ **actor_property,},)diff --git a/plugins/discourse-workflows/lib/discourse_workflows/nodes/topic_pin/v1.rb b/plugins/discourse-workflows/lib/discourse_workflows/nodes/topic_pin/v1.rbindex 683c90e6ebf..b172cc677a2 100644--- a/plugins/discourse-workflows/lib/discourse_workflows/nodes/topic_pin/v1.rb+++ b/plugins/discourse-workflows/lib/discourse_workflows/nodes/topic_pin/v1.rb@@ -129,14 +129,7 @@ module DiscourseWorkflows},},},- actor_username: {- type: :string,- required: false,- default: "system",- ui: {- control: :actor,- },- },+ **actor_property,},)diff --git a/plugins/discourse-workflows/lib/discourse_workflows/nodes/topic_tags/v1.rb b/plugins/discourse-workflows/lib/discourse_workflows/nodes/topic_tags/v1.rbindex ed30f330f0a..f36eb06c062 100644--- a/plugins/discourse-workflows/lib/discourse_workflows/nodes/topic_tags/v1.rb+++ b/plugins/discourse-workflows/lib/discourse_workflows/nodes/topic_tags/v1.rb@@ -57,14 +57,7 @@ module DiscourseWorkflowscontrol: :tags,},},- actor_username: {- type: :string,- required: false,- default: "system",- ui: {- control: :actor,- },- },+ **actor_property,},)diff --git a/plugins/discourse-workflows/lib/discourse_workflows/nodes/user/v1.rb b/plugins/discourse-workflows/lib/discourse_workflows/nodes/user/v1.rbindex 8ad4c72513e..fc941cf6ae3 100644--- a/plugins/discourse-workflows/lib/discourse_workflows/nodes/user/v1.rb+++ b/plugins/discourse-workflows/lib/discourse_workflows/nodes/user/v1.rb@@ -97,14 +97,7 @@ module DiscourseWorkflowsoptions: EXTENSIONS.keys,default: [],},- actor_username: {- type: :string,- required: false,- default: "system",- ui: {- control: :actor,- },- },+ **actor_property,},)