From 69339b721f27ad541805dbc8443cae6a1785737b Mon Sep 17 00:00:00 2001 From: merefield Date: Wed, 20 May 2026 13:26:51 +0100 Subject: [PATCH 1/6] FIX: return topic actions to processes --- .../discourse/components/process-buttons.gjs | 2 +- spec/system/page_objects/pages/process_topic.rb | 5 +++++ spec/system/process_topic_banner_spec.rb | 13 +++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/assets/javascripts/discourse/components/process-buttons.gjs b/assets/javascripts/discourse/components/process-buttons.gjs index a238fdb..a57ca2a 100644 --- a/assets/javascripts/discourse/components/process-buttons.gjs +++ b/assets/javascripts/discourse/components/process-buttons.gjs @@ -53,7 +53,7 @@ export default class ProcessButtonsComponent extends Component { data: { option }, }) .then(() => { - this.router.transitionTo("/c/" + this.args.category_id); + this.router.transitionTo("discovery.processes"); }) .catch(async (err) => { this.transitioningOption = null; diff --git a/spec/system/page_objects/pages/process_topic.rb b/spec/system/page_objects/pages/process_topic.rb index def8c07..7cf01e2 100644 --- a/spec/system/page_objects/pages/process_topic.rb +++ b/spec/system/page_objects/pages/process_topic.rb @@ -23,6 +23,11 @@ def has_disabled_action_button? def has_step_age_badge_text?(text) has_css?(".process-step-age-badge", text: text) end + + def click_process_action(label) + find(".process-step-actions .process-action-button .btn", text: label).click + self + end end end end diff --git a/spec/system/process_topic_banner_spec.rb b/spec/system/process_topic_banner_spec.rb index 3134282..9d42bfd 100644 --- a/spec/system/process_topic_banner_spec.rb +++ b/spec/system/process_topic_banner_spec.rb @@ -1,6 +1,10 @@ # frozen_string_literal: true RSpec.describe "Process topic banner" do + let(:dialog) { PageObjects::Components::Dialog.new } + let(:process_topic_page) { PageObjects::Pages::ProcessTopic.new } + + fab!(:admin) fab!(:actor, :user) fab!(:viewer, :user) fab!(:actor_group, :group) @@ -92,4 +96,13 @@ expect(Time.zone.parse(entered_at)).to be < 2.days.ago end + + it "returns to process discovery after a topic action" do + sign_in(admin) + process_topic_page.visit_topic(topic).click_process_action("Accept") + dialog.click_yes + + expect(page).to have_current_path("/processes", url: false) + expect(process_state.reload.process_step_id).to eq(step_2.id) + end end From 53e44a0f86cd003da768e785380065484b3352a4 Mon Sep 17 00:00:00 2001 From: merefield Date: Wed, 20 May 2026 13:29:40 +0100 Subject: [PATCH 2/6] UX: clarify process action confirmations --- .../discourse/components/process-buttons.gjs | 11 ++++--- config/locales/client.en.yml | 33 ++++++++++--------- spec/system/process_topic_banner_spec.rb | 5 +++ 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/assets/javascripts/discourse/components/process-buttons.gjs b/assets/javascripts/discourse/components/process-buttons.gjs index a57ca2a..2faccd4 100644 --- a/assets/javascripts/discourse/components/process-buttons.gjs +++ b/assets/javascripts/discourse/components/process-buttons.gjs @@ -39,10 +39,13 @@ export default class ProcessButtonsComponent extends Component { return; } - const message = i18n(`process_manager.options.${option}.confirmation`); - const targetSuffix = this.processActionHelperText(processAction); - const confirmationMessage = - targetSuffix && message ? `${message} ${targetSuffix}` : message; + const confirmation = i18n(`process_manager.options.${option}.confirmation`); + const confirmationMessage = processAction.target_step_name + ? i18n("process_manager.topic_banner.transition_confirmation_target", { + confirmation: confirmation.replace(/\?$/, ""), + target_step_name: processAction.target_step_name, + }) + : confirmation; this.dialog.yesNoConfirm({ message: confirmationMessage, diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 662d64c..f71abeb 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -43,7 +43,8 @@ en: one: "In this step for %{count} day" other: "In this step for %{count} days" actions_intro: "Actions:" - transition_target: "-> %{target_step_name}" + transition_target: "Target step: %{target_step_name}" + transition_confirmation_target: "%{confirmation} and move it to %{target_step_name}?" blocked_reason_create_permission: "You can reply in this step, but only users with topic creation permission in this category can transition it." visualisation_button: "Visualise" visualisation_title: "Process: %{process_name}" @@ -77,49 +78,49 @@ en: options: submit: button_label: "Submit" - confirmation: "Are you sure you want to submit this topic?" + confirmation: "Are you sure you want to submit this item?" start: button_label: "Start" - confirmation: "Are you sure you want to start this process?" + confirmation: "Are you sure you want to start this item?" accept: button_label: "Accept" - confirmation: "Are you sure you want to accept this topic?" + confirmation: "Are you sure you want to accept this item?" reject: button_label: "Reject" - confirmation: "Are you sure you want to reject this topic?" + confirmation: "Are you sure you want to reject this item?" great: button_label: "Great" - confirmation: "Are you sure you want to mark this topic as great?" + confirmation: "Are you sure you want to mark this item as great?" good: button_label: "Good" - confirmation: "Are you sure you want to mark this topic as good?" + confirmation: "Are you sure you want to mark this item as good?" average: button_label: "Average" - confirmation: "Are you sure you want to mark this topic as average?" + confirmation: "Are you sure you want to mark this item as average?" bad: button_label: "Bad" - confirmation: "Are you sure you want to mark this topic as bad?" + confirmation: "Are you sure you want to mark this item as bad?" terrible: button_label: "Terrible" - confirmation: "Are you sure you want to mark this topic as terrible?" + confirmation: "Are you sure you want to mark this item as terrible?" done: button_label: "Done" - confirmation: "Are you sure you want to mark this topic as done?" + confirmation: "Are you sure you want to mark this item as done?" next: button_label: "Next" - confirmation: "Are you sure you want to move this Topic to the next step?" + confirmation: "Are you sure you want to move this item to the next step?" back: button_label: "Back" - confirmation: "Are you sure you want to move this Topic back to the previous step?" + confirmation: "Are you sure you want to move this item back to the previous step?" finish: button_label: "Finish" - confirmation: "Are you sure you want to finish this process?" + confirmation: "Are you sure you want to finish this item?" close: button_label: "Close" - confirmation: "Are you sure you want to close this process?" + confirmation: "Are you sure you want to close this item?" reopen: button_label: "Reopen" - confirmation: "Are you sure you want to reopen this process?" + confirmation: "Are you sure you want to reopen this item?" admin_js: admin: site_settings: diff --git a/spec/system/process_topic_banner_spec.rb b/spec/system/process_topic_banner_spec.rb index 9d42bfd..f29afa7 100644 --- a/spec/system/process_topic_banner_spec.rb +++ b/spec/system/process_topic_banner_spec.rb @@ -100,6 +100,11 @@ it "returns to process discovery after a topic action" do sign_in(admin) process_topic_page.visit_topic(topic).click_process_action("Accept") + + expect(dialog).to have_content( + "Are you sure you want to accept this item and move it to Review?", + ) + dialog.click_yes expect(page).to have_current_path("/processes", url: false) From 5c2dd8e6753f148ec833cc2979fd6ea9b82b43cd Mon Sep 17 00:00:00 2001 From: merefield Date: Wed, 20 May 2026 13:37:45 +0100 Subject: [PATCH 3/6] DEV: migrate transition action codes --- ...rename_workflow_transition_post_actions.rb | 30 +++++++++++++++++++ ...e_workflow_transition_post_actions_spec.rb | 30 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 db/migrate/20260520123325_rename_workflow_transition_post_actions.rb create mode 100644 spec/db/migrate/20260520123325_rename_workflow_transition_post_actions_spec.rb diff --git a/db/migrate/20260520123325_rename_workflow_transition_post_actions.rb b/db/migrate/20260520123325_rename_workflow_transition_post_actions.rb new file mode 100644 index 0000000..4da1e72 --- /dev/null +++ b/db/migrate/20260520123325_rename_workflow_transition_post_actions.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class RenameWorkflowTransitionPostActions < ActiveRecord::Migration[8.0] + disable_ddl_transaction! + + BATCH_SIZE = 50_000 + + def up + max_id = select_value("SELECT COALESCE(MAX(id), 0) FROM posts").to_i + lower_id = 0 + + while lower_id < max_id + upper_id = lower_id + BATCH_SIZE + + execute <<~SQL + UPDATE posts + SET action_code = 'process_transition' + WHERE id > #{lower_id} + AND id <= #{upper_id} + AND action_code = 'workflow_transition' + SQL + + lower_id = upper_id + end + end + + def down + raise ActiveRecord::IrreversibleMigration + end +end diff --git a/spec/db/migrate/20260520123325_rename_workflow_transition_post_actions_spec.rb b/spec/db/migrate/20260520123325_rename_workflow_transition_post_actions_spec.rb new file mode 100644 index 0000000..0e38ba8 --- /dev/null +++ b/spec/db/migrate/20260520123325_rename_workflow_transition_post_actions_spec.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +require_relative "../../plugin_helper" +require Rails.root.join( + "plugins/discourse-process-manager/db/migrate/20260520123325_rename_workflow_transition_post_actions", + ) + +RSpec.describe RenameWorkflowTransitionPostActions do + before do + @original_verbose = ActiveRecord::Migration.verbose + ActiveRecord::Migration.verbose = false + end + + after { ActiveRecord::Migration.verbose = @original_verbose } + + it "renames legacy process transition small action codes" do + legacy_post = + Fabricate(:post, post_type: Post.types[:small_action], action_code: "workflow_transition") + current_post = + Fabricate(:post, post_type: Post.types[:small_action], action_code: "process_transition") + unrelated_post = + Fabricate(:post, post_type: Post.types[:small_action], action_code: "closed.enabled") + + described_class.new.up + + expect(legacy_post.reload.action_code).to eq("process_transition") + expect(current_post.reload.action_code).to eq("process_transition") + expect(unrelated_post.reload.action_code).to eq("closed.enabled") + end +end From 74ae6f1dfbadcc73c13380c38f0cfdd70aac4325 Mon Sep 17 00:00:00 2001 From: merefield Date: Wed, 20 May 2026 14:01:03 +0100 Subject: [PATCH 4/6] FIX: support legacy transition action code --- .../initializers/init-process-manager.gjs | 2 ++ config/locales/client.en.yml | 1 + ...rename_workflow_transition_post_actions.rb | 30 ------------------- ...e_workflow_transition_post_actions_spec.rb | 30 ------------------- ...cess_transition_legacy_action_code_spec.rb | 24 +++++++++++++++ 5 files changed, 27 insertions(+), 60 deletions(-) delete mode 100644 db/migrate/20260520123325_rename_workflow_transition_post_actions.rb delete mode 100644 spec/db/migrate/20260520123325_rename_workflow_transition_post_actions_spec.rb create mode 100644 spec/lib/process_transition_legacy_action_code_spec.rb diff --git a/assets/javascripts/discourse/initializers/init-process-manager.gjs b/assets/javascripts/discourse/initializers/init-process-manager.gjs index 44a930f..82acf32 100644 --- a/assets/javascripts/discourse/initializers/init-process-manager.gjs +++ b/assets/javascripts/discourse/initializers/init-process-manager.gjs @@ -198,6 +198,8 @@ export default { ); api.addPostSmallActionIcon("process_transition", "right-left"); + // TODO(11-2026): Remove this legacy action code after Workflow-era posts have aged out. + api.addPostSmallActionIcon("workflow_transition", "right-left"); }); }, }; diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index f71abeb..d8a2390 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -18,6 +18,7 @@ en: process_topic_arrival: "A topic titled %{topic_title} has arrived in step: %{process_step_name} of the process: %{process_name}, authored by %{username}" action_codes: process_transition: "acted upon topic in a process %{when}" + workflow_transition: "acted upon topic in a process %{when}" topics: bottom: processes: Currently, there are no more viewable process topics. diff --git a/db/migrate/20260520123325_rename_workflow_transition_post_actions.rb b/db/migrate/20260520123325_rename_workflow_transition_post_actions.rb deleted file mode 100644 index 4da1e72..0000000 --- a/db/migrate/20260520123325_rename_workflow_transition_post_actions.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -class RenameWorkflowTransitionPostActions < ActiveRecord::Migration[8.0] - disable_ddl_transaction! - - BATCH_SIZE = 50_000 - - def up - max_id = select_value("SELECT COALESCE(MAX(id), 0) FROM posts").to_i - lower_id = 0 - - while lower_id < max_id - upper_id = lower_id + BATCH_SIZE - - execute <<~SQL - UPDATE posts - SET action_code = 'process_transition' - WHERE id > #{lower_id} - AND id <= #{upper_id} - AND action_code = 'workflow_transition' - SQL - - lower_id = upper_id - end - end - - def down - raise ActiveRecord::IrreversibleMigration - end -end diff --git a/spec/db/migrate/20260520123325_rename_workflow_transition_post_actions_spec.rb b/spec/db/migrate/20260520123325_rename_workflow_transition_post_actions_spec.rb deleted file mode 100644 index 0e38ba8..0000000 --- a/spec/db/migrate/20260520123325_rename_workflow_transition_post_actions_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -require_relative "../../plugin_helper" -require Rails.root.join( - "plugins/discourse-process-manager/db/migrate/20260520123325_rename_workflow_transition_post_actions", - ) - -RSpec.describe RenameWorkflowTransitionPostActions do - before do - @original_verbose = ActiveRecord::Migration.verbose - ActiveRecord::Migration.verbose = false - end - - after { ActiveRecord::Migration.verbose = @original_verbose } - - it "renames legacy process transition small action codes" do - legacy_post = - Fabricate(:post, post_type: Post.types[:small_action], action_code: "workflow_transition") - current_post = - Fabricate(:post, post_type: Post.types[:small_action], action_code: "process_transition") - unrelated_post = - Fabricate(:post, post_type: Post.types[:small_action], action_code: "closed.enabled") - - described_class.new.up - - expect(legacy_post.reload.action_code).to eq("process_transition") - expect(current_post.reload.action_code).to eq("process_transition") - expect(unrelated_post.reload.action_code).to eq("closed.enabled") - end -end diff --git a/spec/lib/process_transition_legacy_action_code_spec.rb b/spec/lib/process_transition_legacy_action_code_spec.rb new file mode 100644 index 0000000..fe541c1 --- /dev/null +++ b/spec/lib/process_transition_legacy_action_code_spec.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +require_relative "../plugin_helper" + +RSpec.describe "Process transition legacy action code support" do + it "keeps a client translation for legacy Workflow-era small action posts" do + locale_path = File.expand_path("../../config/locales/client.en.yml", __dir__) + source = File.read(locale_path) + + expect(source).to include('workflow_transition: "acted upon topic in a process %{when}"') + end + + it "keeps a small action icon for legacy Workflow-era small action posts" do + initializer_path = + File.expand_path( + "../../assets/javascripts/discourse/initializers/init-process-manager.gjs", + __dir__, + ) + source = File.read(initializer_path) + + expect(source).to include('api.addPostSmallActionIcon("workflow_transition", "right-left")') + expect(source).to include("Remove this legacy action code") + end +end From 43f69b511449317d830295c13390766dd0819f15 Mon Sep 17 00:00:00 2001 From: merefield Date: Wed, 20 May 2026 14:15:16 +0100 Subject: [PATCH 5/6] CHORE: bump patch version --- plugin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.rb b/plugin.rb index 742915f..00840fa 100644 --- a/plugin.rb +++ b/plugin.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # name: discourse-process-manager # about: A process management plugin for Discourse -# version: 0.6.0 +# version: 0.6.1 # authors: Robert Barrow # contact_emails: robert@pavilion.tech # url: https://github.com/merefield/discourse-process-manager From 16bce8753b96208d4b91e70ec5a20d63be9dca4e Mon Sep 17 00:00:00 2001 From: merefield Date: Wed, 20 May 2026 14:17:04 +0100 Subject: [PATCH 6/6] CHORE: add funding link --- .github/FUNDING.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..fb1ac57 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: [merefield]