Skip to content

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

FEATURE: Add `enable_discourse_workflows` upcoming change (#41541)

Joffrey JAFFEUX2e8b5f94a91c
diff --git a/db/structure.sql b/db/structure.sql
index c65799d93ee..94d9144015e 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -22469,6 +22469,7 @@ ALTER TABLE ONLY public.ad_plugin_house_ads_groups
SET search_path TO "$user", public;
INSERT INTO "schema_migrations" (version) VALUES
+('20260708095336'),
('20260708080308'),
('20260707013407'),
('20260702102111'),
diff --git a/plugins/chat/app/services/chat/workflows/approval/resume.rb b/plugins/chat/app/services/chat/workflows/approval/resume.rb
index e7279ec8ca4..63cc795852a 100644
--- a/plugins/chat/app/services/chat/workflows/approval/resume.rb
+++ b/plugins/chat/app/services/chat/workflows/approval/resume.rb
@@ -23,7 +23,7 @@ module Chat
private
def workflows_enabled
- SiteSetting.discourse_workflows_enabled
+ SiteSetting.enable_discourse_workflows
end
def fetch_resume_request(params:)
diff --git a/plugins/chat/plugin.rb b/plugins/chat/plugin.rb
index fb95365468d..59355f1dbfe 100644
--- a/plugins/chat/plugin.rb
+++ b/plugins/chat/plugin.rb
@@ -124,7 +124,7 @@ after_initialize do
end
on(:chat_message_interaction) do |interaction|
- next unless SiteSetting.discourse_workflows_enabled
+ next unless SiteSetting.enable_discourse_workflows
action_id = interaction.action&.dig("action_id").to_s
next if action_id.blank?
diff --git a/plugins/chat/spec/integration/workflows_chat_approval_spec.rb b/plugins/chat/spec/integration/workflows_chat_approval_spec.rb
index 8a12c433548..1c2bf709895 100644
--- a/plugins/chat/spec/integration/workflows_chat_approval_spec.rb
+++ b/plugins/chat/spec/integration/workflows_chat_approval_spec.rb
@@ -7,7 +7,7 @@ RSpec.describe "Wait for Approval end-to-end" do
before do
SiteSetting.chat_enabled = true
- SiteSetting.discourse_workflows_enabled = true
+ SiteSetting.enable_discourse_workflows = true
end
def run_pending_approval_job
diff --git a/plugins/chat/spec/integration/workflows_chat_interaction_spec.rb b/plugins/chat/spec/integration/workflows_chat_interaction_spec.rb
index 24c05fdf56c..c04b9bce876 100644
--- a/plugins/chat/spec/integration/workflows_chat_interaction_spec.rb
+++ b/plugins/chat/spec/integration/workflows_chat_interaction_spec.rb
@@ -7,7 +7,7 @@ RSpec.describe "Chat interaction listener for workflow approvals" do
before do
SiteSetting.chat_enabled = true
- SiteSetting.discourse_workflows_enabled = true
+ SiteSetting.enable_discourse_workflows = true
end
it "enqueues ResumeWorkflowApproval when an approve button is clicked" do
diff --git a/plugins/chat/spec/integration/workflows_chat_message_created_spec.rb b/plugins/chat/spec/integration/workflows_chat_message_created_spec.rb
index 5839777a20b..d66a11bcc54 100644
--- a/plugins/chat/spec/integration/workflows_chat_message_created_spec.rb
+++ b/plugins/chat/spec/integration/workflows_chat_message_created_spec.rb
@@ -7,7 +7,7 @@ RSpec.describe "Chat message created workflow trigger" do
before do
SiteSetting.chat_enabled = true
- SiteSetting.discourse_workflows_enabled = true
+ SiteSetting.enable_discourse_workflows = true
end
it "enqueues matching workflows when a chat message is created" do
diff --git a/plugins/chat/spec/services/chat/workflows/approval/resume_spec.rb b/plugins/chat/spec/services/chat/workflows/approval/resume_spec.rb
index 4c250b4e14e..6d11280a0e7 100644
--- a/plugins/chat/spec/services/chat/workflows/approval/resume_spec.rb
+++ b/plugins/chat/spec/services/chat/workflows/approval/resume_spec.rb
@@ -26,11 +26,11 @@ RSpec.describe Chat::Workflows::Approval::Resume do
before do
SiteSetting.chat_enabled = true
- SiteSetting.discourse_workflows_enabled = true
+ SiteSetting.enable_discourse_workflows = true
end
context "when plugin is disabled" do
- before { SiteSetting.discourse_workflows_enabled = false }
+ before { SiteSetting.enable_discourse_workflows = false }
it { is_expected.to fail_a_policy(:workflows_enabled) }
end
diff --git a/plugins/discourse-assign/spec/lib/assigner_spec.rb b/plugins/discourse-assign/spec/lib/assigner_spec.rb
index 65267b342c6..011ee42d4dd 100644
--- a/plugins/discourse-assign/spec/lib/assigner_spec.rb
+++ b/plugins/discourse-assign/spec/lib/assigner_spec.rb
@@ -157,7 +157,7 @@ RSpec.describe Assigner do
end
it "enqueues assigned workflows matching the assignment target" do
- SiteSetting.discourse_workflows_enabled = true
+ SiteSetting.enable_discourse_workflows = true
Jobs::DiscourseWorkflows::ExecuteWorkflow.jobs.clear
DiscourseWorkflows::Registry.reset_indexes!
diff --git a/plugins/discourse-assign/spec/lib/discourse_workflows/nodes/assign_topic/v1_spec.rb b/plugins/discourse-assign/spec/lib/discourse_workflows/nodes/assign_topic/v1_spec.rb
index 784cf7e2c76..93ffede9cc5 100644
--- a/plugins/discourse-assign/spec/lib/discourse_workflows/nodes/assign_topic/v1_spec.rb
+++ b/plugins/discourse-assign/spec/lib/discourse_workflows/nodes/assign_topic/v1_spec.rb
@@ -11,7 +11,7 @@ RSpec.describe DiscourseWorkflows::Nodes::AssignTopic::V1 do
after { sandbox.dispose }
before do
- SiteSetting.discourse_workflows_enabled = true
+ SiteSetting.enable_discourse_workflows = true
SiteSetting.assign_enabled = true
end
diff --git a/plugins/discourse-assign/spec/lib/discourse_workflows/nodes/assigned/v1_spec.rb b/plugins/discourse-assign/spec/lib/discourse_workflows/nodes/assigned/v1_spec.rb
index fd8cf89310a..262c07057b9 100644
--- a/plugins/discourse-assign/spec/lib/discourse_workflows/nodes/assigned/v1_spec.rb
+++ b/plugins/discourse-assign/spec/lib/discourse_workflows/nodes/assigned/v1_spec.rb
@@ -9,7 +9,7 @@ RSpec.describe DiscourseWorkflows::Nodes::Assigned::V1 do
before do
SiteSetting.assign_enabled = true
- SiteSetting.discourse_workflows_enabled = true
+ SiteSetting.enable_discourse_workflows = true
end
describe "#valid?" do
diff --git a/plugins/discourse-workflows/app/jobs/regular/discourse_workflows/execute_manual_workflow.rb b/plugins/discourse-workflows/app/jobs/regular/discourse_workflows/execute_manual_workflow.rb
index 7a4293da32e..0b99722187c 100644
--- a/plugins/discourse-workflows/app/jobs/regular/discourse_workflows/execute_manual_workflow.rb
+++ b/plugins/discourse-workflows/app/jobs/regular/discourse_workflows/execute_manual_workflow.rb
@@ -10,7 +10,7 @@ module Jobs
)
return if !execution&.pending?
- if !SiteSetting.discourse_workflows_enabled
+ if !SiteSetting.enable_discourse_workflows
execution.update!(status: :skipped, finished_at: Time.current)
return
end
diff --git a/plugins/discourse-workflows/app/jobs/regular/discourse_workflows/resume_waiting_execution.rb b/plugins/discourse-workflows/app/jobs/regular/discourse_workflows/resume_waiting_execution.rb
index e41cba33ecd..a8d4de109e1 100644
--- a/plugins/discourse-workflows/app/jobs/regular/discourse_workflows/resume_waiting_execution.rb
+++ b/plugins/discourse-workflows/app/jobs/regular/discourse_workflows/resume_waiting_execution.rb
@@ -4,7 +4,7 @@ module Jobs
module DiscourseWorkflows
class ResumeWaitingExecution < ::Jobs::Base
def execute(args)
- return unless SiteSetting.discourse_workflows_enabled
+ return unless SiteSetting.enable_discourse_workflows
execution = ::DiscourseWorkflows::Execution.find_by(id: args[:execution_id])
return if execution.nil? || !execution.waiting?
diff --git a/plugins/discourse-workflows/app/jobs/regular/discourse_workflows/resume_webhook_waiting.rb b/plugins/discourse-workflows/app/jobs/regular/discourse_workflows/resume_webhook_waiting.rb
index c5db7987d06..dc625b5e0a4 100644
--- a/plugins/discourse-workflows/app/jobs/regular/discourse_workflows/resume_webhook_waiting.rb
+++ b/plugins/discourse-workflows/app/jobs/regular/discourse_workflows/resume_webhook_waiting.rb
@@ -4,7 +4,7 @@ module Jobs
module DiscourseWorkflows
class ResumeWebhookWaiting < ::Jobs::Base
def execute(args)
- return unless SiteSetting.discourse_workflows_enabled
+ return unless SiteSetting.enable_discourse_workflows
execution =
::DiscourseWorkflows::Execution.find_by(id: args[:execution_id], status: :waiting)
diff --git a/plugins/discourse-workflows/app/services/discourse_workflows/policy/workflows_enabled.rb b/plugins/discourse-workflows/app/services/discourse_workflows/policy/workflows_enabled.rb
index 176cfb71c14..ffcc7cded98 100644
--- a/plugins/discourse-workflows/app/services/discourse_workflows/policy/workflows_enabled.rb
+++ b/plugins/discourse-workflows/app/services/discourse_workflows/policy/workflows_enabled.rb
@@ -3,7 +3,7 @@
module DiscourseWorkflows
class Policy::WorkflowsEnabled < Service::PolicyBase
def call
- SiteSetting.discourse_workflows_enabled
+ SiteSetting.enable_discourse_workflows
end
def reason
diff --git a/plugins/discourse-workflows/config/locales/server.en.yml b/plugins/discourse-workflows/config/locales/server.en.yml
index 18e3255a6c0..fc863661c68 100644
--- a/plugins/discourse-workflows/config/locales/server.en.yml
+++ b/plugins/discourse-workflows/config/locales/server.en.yml
@@ -146,7 +146,7 @@ en:
split_out:
field_not_found: "The field '%{field}' wasn't found in any input item."
site_settings:
- discourse_workflows_enabled: "Enable the discourse-workflows plugin."
+ enable_discourse_workflows: "Enable the discourse-workflows plugin."
discourse_workflows_ai_authoring_enabled: "Enable AI-assisted workflow authoring."
discourse_workflows_ai_authoring_max_prompt_length: "Maximum length for AI workflow authoring prompts."
discourse_workflows_ai_authoring_rate_limit_per_minute: "Maximum AI workflow authoring requests per minute per user."
diff --git a/plugins/discourse-workflows/config/settings.yml b/plugins/discourse-workflows/config/settings.yml
index 7bda0b7dcdb..43a73303c0d 100644
--- a/plugins/discourse-workflows/config/settings.yml
+++ b/plugins/discourse-workflows/config/settings.yml
@@ -1,8 +1,14 @@
plugins:
- discourse_workflows_enabled:
+ enable_discourse_workflows:
default: false
client: true
hidden: true
+ upcoming_change:
+ status: "experimental"
+ impact: "feature,admins"
+ learn_more_url: "https://meta.discourse.org/t/-/406990"
+ allow_enabled_for:
+ - everyone
discourse_workflows_ai_authoring_enabled:
default: false
client: true
diff --git a/plugins/discourse-workflows/db/migrate/20260708095336_rename_discourse_workflows_enabled_site_setting.rb b/plugins/discourse-workflows/db/migrate/20260708095336_rename_discourse_workflows_enabled_site_setting.rb
new file mode 100644
index 00000000000..ad97da1e24a
--- /dev/null
+++ b/plugins/discourse-workflows/db/migrate/20260708095336_rename_discourse_workflows_enabled_site_setting.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class RenameDiscourseWorkflowsEnabledSiteSetting < ActiveRecord::Migration[8.0]
+ def up
+ execute "UPDATE site_settings SET name = 'enable_discourse_workflows' WHERE name = 'discourse_workflows_enabled'"
+ end
+
+ def down
+ execute "UPDATE site_settings SET name = 'discourse_workflows_enabled' WHERE name = 'enable_discourse_workflows'"
+ end
+end
diff --git a/plugins/discourse-workflows/lib/discourse_workflows/ai_authoring_enqueuer.rb b/plugins/discourse-workflows/lib/discourse_workflows/ai_authoring_enqueuer.rb
index 115c065e447..60bb074a9c7 100644
--- a/plugins/discourse-workflows/lib/discourse_workflows/ai_authoring_enqueuer.rb
+++ b/plugins/discourse-workflows/lib/discourse_workflows/ai_authoring_enqueuer.rb
@@ -3,7 +3,7 @@
module DiscourseWorkflows
class AiAuthoringEnqueuer
def self.enabled?
- SiteSetting.discourse_workflows_enabled &&
+ SiteSetting.enable_discourse_workflows &&
SiteSetting.discourse_workflows_ai_authoring_enabled && defined?(DiscourseAi).present?
end
diff --git a/plugins/discourse-workflows/lib/discourse_workflows/dev_populator.rb b/plugins/discourse-workflows/lib/discourse_workflows/dev_populator.rb
index 8d347610b63..6333a3b962b 100644
--- a/plugins/discourse-workflows/lib/discourse_workflows/dev_populator.rb
+++ b/plugins/discourse-workflows/lib/discourse_workflows/dev_populator.rb
@@ -14,9 +14,7 @@ module DiscourseWorkflows
raise "Workflow examples are only supported in development environment"
end
- if !SiteSetting.discourse_workflows_enabled
- SiteSetting.set(:discourse_workflows_enabled, true)
- end
+ SiteSetting.set(:enable_discourse_workflows, true) if !SiteSetting.enable_discourse_workflows
ensure_manual_log_workflow!
ensure_topic_admin_button_workflow!
diff --git a/plugins/discourse-workflows/lib/discourse_workflows/event_listener.rb b/plugins/discourse-workflows/lib/discourse_workflows/event_listener.rb
index d9a83f4cf93..77bb9c9c854 100644
--- a/plugins/discourse-workflows/lib/discourse_workflows/event_listener.rb
+++ b/plugins/discourse-workflows/lib/discourse_workflows/event_listener.rb
@@ -3,7 +3,7 @@
module DiscourseWorkflows
class EventListener
def self.handle(trigger_class, *args)
- return unless SiteSetting.discourse_workflows_enabled
+ return unless SiteSetting.enable_discourse_workflows
return if WorkflowDependency.active_node_types.exclude?(trigger_class.identifier)
trigger = trigger_class.new(*args)
diff --git a/plugins/discourse-workflows/lib/discourse_workflows/workflow_call_continuation.rb b/plugins/discourse-workflows/lib/discourse_workflows/workflow_call_continuation.rb
index 6b9f554ef35..863e765de11 100644
--- a/plugins/discourse-workflows/lib/discourse_workflows/workflow_call_continuation.rb
+++ b/plugins/discourse-workflows/lib/discourse_workflows/workflow_call_continuation.rb
@@ -22,7 +22,7 @@ module DiscourseWorkflows
end
def run!(run_id:)
- return unless SiteSetting.discourse_workflows_enabled
+ return unless SiteSetting.enable_discourse_workflows
run = WorkflowCallRun.find_by(id: run_id)
return if run.blank?
diff --git a/plugins/discourse-workflows/plugin.rb b/plugins/discourse-workflows/plugin.rb
index d227fc94e86..836fe7f4a59 100644
--- a/plugins/discourse-workflows/plugin.rb
+++ b/plugins/discourse-workflows/plugin.rb
@@ -2,12 +2,12 @@
# name: discourse-workflows
# about: Workflow automation system for Discourse
-# meta_topic_id: 402418
+# meta_topic_id: 406990
# version: 0.1
# authors: Discourse
# url: https://github.com/discourse/discourse-workflows
-enabled_site_setting :discourse_workflows_enabled
+enabled_site_setting :enable_discourse_workflows
module ::DiscourseWorkflows
PLUGIN_NAME = "discourse-workflows"
@@ -131,9 +131,21 @@ after_initialize do
end
on(:site_setting_changed) do |name, old_value, new_value|
- next if name != :discourse_workflows_enabled
+ next if name != :enable_discourse_workflows
next unless new_value && !old_value
DiscourseWorkflows::PluginEnableHandler.handle!
end
+
+ # Automatic promotion of an upcoming change does not write the site setting,
+ # so :site_setting_changed never fires for it. See UpcomingChanges::NotifyPromotion.
+ on(:upcoming_change_enabled) do |name|
+ next if name != :enable_discourse_workflows
+
+ # A manual opt-in writes the setting before this event fires, so the
+ # :site_setting_changed hook above has already run.
+ next if SiteSetting.setting_modified_from_default?(:enable_discourse_workflows)
+
+ DiscourseWorkflows::PluginEnableHandler.handle!
+ end
end
diff --git a/plugins/discourse-workflows/public/images/upcoming_changes/enable_discourse_workflows.png b/plugins/discourse-workflows/public/images/upcoming_changes/enable_discourse_workflows.png
new file mode 100644
index 00000000000..c62d36720e9
Binary files /dev/null and b/plugins/discourse-workflows/public/images/upcoming_changes/enable_discourse_workflows.png differ
diff --git a/plugins/discourse-workflows/spec/db/migrate/rename_discourse_workflows_enabled_site_setting_spec.rb b/plugins/discourse-workflows/spec/db/migrate/rename_discourse_workflows_enabled_site_setting_spec.rb
new file mode 100644
index 00000000000..80118454a35
--- /dev/null
+++ b/plugins/discourse-workflows/spec/db/migrate/rename_discourse_workflows_enabled_site_setting_spec.rb
@@ -0,0 +1,57 @@
+# frozen_string_literal: true
+
+require Rails.root.join(
+ "plugins/discourse-workflows/db/migrate/20260708095336_rename_discourse_workflows_enabled_site_setting",
+ )
+
+RSpec.describe RenameDiscourseWorkflowsEnabledSiteSetting do
+ subject(:migration) { described_class.new }
+
+ let(:connection) { ActiveRecord::Base.connection }
+
+ around { |example| ActiveRecord::Migration.suppress_messages { example.run } }
+
+ before { delete_workflow_settings }
+
+ after { delete_workflow_settings }
+
+ def delete_workflow_settings
+ connection.execute(<<~SQL)
+ DELETE FROM site_settings
+ WHERE name IN ('discourse_workflows_enabled', 'enable_discourse_workflows')
+ SQL
+ end
+
+ def store_setting(name, value)
+ connection.execute(<<~SQL)
+ INSERT INTO site_settings (name, data_type, value, created_at, updated_at)
+ VALUES ('#{name}', 5, '#{value}', NOW(), NOW())
+ SQL
+ end
+
+ def setting_value(name)
+ DB.query_single("SELECT value FROM site_settings WHERE name = :name", name: name).first
+ end
+
+ it "preserves enabled customer opt-ins" do
+ store_setting("discourse_workflows_enabled", "t")
+
+ migration.up
+
+ aggregate_failures do
+ expect(setting_value("discourse_workflows_enabled")).to be_nil
+ expect(setting_value("enable_discourse_workflows")).to eq("t")
+ end
+ end
+
+ it "restores the old setting name on rollback" do
+ store_setting("enable_discourse_workflows", "t")
+
+ migration.down
+
+ aggregate_failures do
+ expect(setting_value("enable_discourse_workflows")).to be_nil
+ expect(setting_value("discourse_workflows_enabled")).to eq("t")
+ end
+ end
+end
diff --git a/plugins/discourse-workflows/spec/integration/plugin_enable_hook_spec.rb b/plugins/discourse-workflows/spec/integration/plugin_enable_hook_spec.rb
index 9f9ea7364e5..e853783540f 100644
--- a/plugins/discourse-workflows/spec/integration/plugin_enable_hook_spec.rb
+++ b/plugins/discourse-workflows/spec/integration/plugin_enable_hook_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe "discourse_workflows_enabled site setting hook" do
+describe "enable_discourse_workflows site setting hook" do
fab!(:workflow) { Fabricate(:discourse_workflows_workflow, published: true) }
fab!(:execution) do
Fabricate(
@@ -12,29 +12,29 @@ describe "discourse_workflows_enabled site setting hook" do
end
it "reschedules waiting executions when the setting flips false to true" do
- SiteSetting.discourse_workflows_enabled = false
+ SiteSetting.enable_discourse_workflows = false
expect_enqueued_with(
job: Jobs::DiscourseWorkflows::ResumeWaitingExecution,
args: {
execution_id: execution.id,
},
- ) { SiteSetting.discourse_workflows_enabled = true }
+ ) { SiteSetting.enable_discourse_workflows = true }
end
it "does not reschedule when the setting flips true to false" do
- SiteSetting.discourse_workflows_enabled = true
+ SiteSetting.enable_discourse_workflows = true
expect_not_enqueued_with(
job: Jobs::DiscourseWorkflows::ResumeWaitingExecution,
args: {
execution_id: execution.id,
},
- ) { SiteSetting.discourse_workflows_enabled = false }
+ ) { SiteSetting.enable_discourse_workflows = false }
end
it "does not reschedule for unrelated setting changes" do
- SiteSetting.discourse_workflows_enabled = true
+ SiteSetting.enable_discourse_workflows = true
expect_not_enqueued_with(
job: Jobs::DiscourseWorkflows::ResumeWaitingExecution,
@@ -43,4 +43,51 @@ describe "discourse_workflows_enabled site setting hook" do
},
) { SiteSetting.title = "Different title" }
end
+
+ describe "when the upcoming change is automatically promoted" do
+ # Promotion leaves no override in the database, so :site_setting_changed never
+ # fires. The setting reads as enabled purely because the change has reached
+ # promote_upcoming_changes_on_status.
+ before do
+ SiteSetting.remove_override!(:enable_discourse_workflows)
+ SiteSetting.promote_upcoming_changes_on_status = :experimental
+ end
+
+ after { SiteSetting.promote_upcoming_changes_on_status = :beta }
+
+ it "reschedules waiting executions" do
+ expect_enqueued_with(
+ job: Jobs::DiscourseWorkflows::ResumeWaitingExecution,
+ args: {
+ execution_id: execution.id,
+ },
+ ) { DiscourseEvent.trigger(:upcoming_change_enabled, :enable_discourse_workflows) }
+ end
+
+ it "does nothing for an unrelated upcoming change" do
+ DiscourseWorkflows::PluginEnableHandler.expects(:handle!).never
+
+ DiscourseEvent.trigger(:upcoming_change_enabled, :enable_upload_debug_mode)
+ end
+ end
+
+ describe "when an admin manually opts in to the upcoming change" do
+ fab!(:admin)
+
+ before { SiteSetting.remove_override!(:enable_discourse_workflows) }
+
+ it "handles the enable exactly once" do
+ # Toggle writes the setting (firing :site_setting_changed) and then fires
+ # :upcoming_change_enabled, so the handler must not run twice.
+ DiscourseWorkflows::PluginEnableHandler.expects(:handle!).once
+
+ UpcomingChanges::Toggle.call(
+ params: {
+ setting_name: :enable_discourse_workflows,
+ enabled: true,
+ },
+ guardian: admin.guardian,
+ )
+ end
+ end
end
diff --git a/plugins/discourse-workflows/spec/jobs/regular/discourse_workflows/execute_manual_workflow_spec.rb b/plugins/discourse-workflows/spec/jobs/regular/discourse_workflows/execute_manual_workflow_spec.rb
index c21fa585ef4..84aaf5bdf06 100644
--- a/plugins/discourse-workflows/spec/jobs/regular/discourse_workflows/execute_manual_workflow_spec.rb
+++ b/plugins/discourse-workflows/spec/jobs/regular/discourse_workflows/execute_manual_workflow_spec.rb
@@ -37,7 +37,7 @@ RSpec.describe Jobs::DiscourseWorkflows::ExecuteManualWorkflow do
end
it "skips the execution when the plugin is disabled" do
- SiteSetting.discourse_workflows_enabled = false
+ SiteSetting.enable_discourse_workflows = false
workflow = Fabricate(:discourse_workflows_workflow, created_by: admin)
execution = pending_execution(workflow: workflow)
diff --git a/plugins/discourse-workflows/spec/jobs/regular/discourse_workflows/resume_waiting_execution_spec.rb b/plugins/discourse-workflows/spec/jobs/regular/discourse_workflows/resume_waiting_execution_spec.rb
index a8a0421f258..2aecc7f9f21 100644
--- a/plugins/discourse-workflows/spec/jobs/regular/discourse_workflows/resume_waiting_execution_spec.rb
+++ b/plugins/discourse-workflows/spec/jobs/regular/discourse_workflows/resume_waiting_execution_spec.rb
@@ -12,7 +12,7 @@ RSpec.describe Jobs::DiscourseWorkflows::ResumeWaitingExecution do
end
it "leaves the execution waiting when the plugin is disabled" do
- SiteSetting.discourse_workflows_enabled = false
+ SiteSetting.enable_discourse_workflows = false
before_updated_at = execution.updated_at
described_class.new.execute(execution_id: execution.id)
diff --git a/plugins/discourse-workflows/spec/jobs/regular/discourse_workflows/resume_webhook_waiting_spec.rb b/plugins/discourse-workflows/spec/jobs/regular/discourse_workflows/resume_webhook_waiting_spec.rb
index d046169e997..c334384c778 100644
--- a/plugins/discourse-workflows/spec/jobs/regular/discourse_workflows/resume_webhook_waiting_spec.rb
+++ b/plugins/discourse-workflows/spec/jobs/regular/discourse_workflows/resume_webhook_waiting_spec.rb
@@ -7,7 +7,7 @@ RSpec.describe Jobs::DiscourseWorkflows::ResumeWebhookWaiting do
end
it "leaves the execution waiting when the plugin is disabled" do
- SiteSetting.discourse_workflows_enabled = false
+ SiteSetting.enable_discourse_workflows = false
before_updated_at = execution.updated_at
described_class.new.execute(execution_id: execution.id)
diff --git a/plugins/discourse-workflows/spec/lib/discourse_workflows/event_listener_spec.rb b/plugins/discourse-workflows/spec/lib/discourse_workflows/event_listener_spec.rb
index c13a1452063..3782e5f6e08 100644
--- a/plugins/discourse-workflows/spec/lib/discourse_workflows/event_listener_spec.rb
+++ b/plugins/discourse-workflows/spec/lib/discourse_workflows/event_listener_spec.rb
@@ -29,7 +29,7 @@ RSpec.describe DiscourseWorkflows::EventListener do
end
it "does not enqueue when plugin is disabled" do
- SiteSetting.discourse_workflows_enabled = false
+ SiteSetting.enable_discourse_workflows = false
graph = build_workflow_graph { |g| g.node "trigger-1", "trigger:topic_closed" }
workflow = Fabricate(:discourse_workflows_workflow, created_by: user, published: true, **graph)
diff --git a/plugins/discourse-workflows/spec/lib/discourse_workflows/executor_spec.rb b/plugins/discourse-workflows/spec/lib/discourse_workflows/executor_spec.rb
index fa137f7690f..2cbea60ccb7 100644
--- a/plugins/discourse-workflows/spec/lib/discourse_workflows/executor_spec.rb
+++ b/plugins/discourse-workflows/spec/lib/discourse_workflows/executor_spec.rb
@@ -677,7 +677,7 @@ RSpec.describe DiscourseWorkflows::Executor do
let(:plugin) do
p = Plugin::Instance.new
- p.enabled_site_setting(:discourse_workflows_enabled)
+ p.enabled_site_setting(:enable_discourse_workflows)
p
end
diff --git a/plugins/discourse-workflows/spec/plugin_helper.rb b/plugins/discourse-workflows/spec/plugin_helper.rb
index d4ab6753775..f270130b524 100644
--- a/plugins/discourse-workflows/spec/plugin_helper.rb
+++ b/plugins/discourse-workflows/spec/plugin_helper.rb
@@ -7,7 +7,7 @@ module DiscourseWorkflowsSpecHelper
included do
before do
- SiteSetting.discourse_workflows_enabled = true
+ SiteSetting.enable_discourse_workflows = true
SiteSetting.external_system_avatars_url = "https://example.com/avatar/{username}.png"
DiscourseWorkflows::Registry.reset_indexes!
Jobs::DiscourseWorkflows::ExecuteWorkflow.jobs.clear
diff --git a/plugins/discourse-workflows/spec/requests/discourse_workflows/webhooks_controller_spec.rb b/plugins/discourse-workflows/spec/requests/discourse_workflows/webhooks_controller_spec.rb
index d4f8b74af11..0de1e122e69 100644
--- a/plugins/discourse-workflows/spec/requests/discourse_workflows/webhooks_controller_spec.rb
+++ b/plugins/discourse-workflows/spec/requests/discourse_workflows/webhooks_controller_spec.rb
@@ -57,7 +57,7 @@ RSpec.describe DiscourseWorkflows::WebhooksController do
end
it "returns 404 when plugin is disabled" do
- SiteSetting.discourse_workflows_enabled = false
+ SiteSetting.enable_discourse_workflows = false
post "/workflows/webhooks/my-hook.json"
expect(response).to have_http_status(:not_found)
end
diff --git a/plugins/discourse-workflows/spec/services/discourse_workflows/execution/check_schedules_spec.rb b/plugins/discourse-workflows/spec/services/discourse_workflows/execution/check_schedules_spec.rb
index 24312d23e06..77f351f3f7b 100644
--- a/plugins/discourse-workflows/spec/services/discourse_workflows/execution/check_schedules_spec.rb
+++ b/plugins/discourse-workflows/spec/services/discourse_workflows/execution/check_schedules_spec.rb
@@ -25,7 +25,7 @@ RSpec.describe DiscourseWorkflows::Execution::CheckSchedules do
end
context "when plugin is disabled" do
- before { SiteSetting.discourse_workflows_enabled = false }
+ before { SiteSetting.enable_discourse_workflows = false }
it { is_expected.to fail_a_policy(:workflows_enabled) }
end
diff --git a/plugins/discourse-workflows/spec/services/discourse_workflows/execution/check_stale_topics_spec.rb b/plugins/discourse-workflows/spec/services/discourse_workflows/execution/check_stale_topics_spec.rb
index f5f3955a5ae..fa1e25f311d 100644
--- a/plugins/discourse-workflows/spec/services/discourse_workflows/execution/check_stale_topics_spec.rb
+++ b/plugins/discourse-workflows/spec/services/discourse_workflows/execution/check_stale_topics_spec.rb
@@ -15,7 +15,7 @@ RSpec.describe DiscourseWorkflows::Execution::CheckStaleTopics do
end
context "when plugin is disabled" do
- before { SiteSetting.discourse_workflows_enabled = false }
+ before { SiteSetting.enable_discourse_workflows = false }
it { is_expected.to fail_a_policy(:workflows_enabled) }
end
diff --git a/plugins/discourse-workflows/spec/services/discourse_workflows/execution/expire_waiting_spec.rb b/plugins/discourse-workflows/spec/services/discourse_workflows/execution/expire_waiting_spec.rb
index a46aa3c52ae..fb7137ab69d 100644
--- a/plugins/discourse-workflows/spec/services/discourse_workflows/execution/expire_waiting_spec.rb
+++ b/plugins/discourse-workflows/spec/services/discourse_workflows/execution/expire_waiting_spec.rb
@@ -28,7 +28,7 @@ RSpec.describe DiscourseWorkflows::Execution::ExpireWaiting do
end
context "when plugin is disabled" do
- before { SiteSetting.discourse_workflows_enabled = false }
+ before { SiteSetting.enable_discourse_workflows = false }
it { is_expected.to fail_a_policy(:workflows_enabled) }
end
diff --git a/plugins/discourse-workflows/spec/services/discourse_workflows/workflow/execute_spec.rb b/plugins/discourse-workflows/spec/services/discourse_workflows/workflow/execute_spec.rb
index 9e74e2a1a51..a115b0d5b95 100644
--- a/plugins/discourse-workflows/spec/services/discourse_workflows/workflow/execute_spec.rb
+++ b/plugins/discourse-workflows/spec/services/discourse_workflows/workflow/execute_spec.rb
@@ -23,7 +23,7 @@ RSpec.describe DiscourseWorkflows::Workflow::Execute do
end
context "when workflows are not enabled" do
- before { SiteSetting.discourse_workflows_enabled = false }
+ before { SiteSetting.enable_discourse_workflows = false }
it { is_expected.to fail_a_policy(:can_execute) }
end