Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [merefield]
13 changes: 8 additions & 5 deletions assets/javascripts/discourse/components/process-buttons.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -53,7 +56,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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});
},
};
34 changes: 18 additions & 16 deletions config/locales/client.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -43,7 +44,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}"
Expand Down Expand Up @@ -77,49 +79,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:
Expand Down
2 changes: 1 addition & 1 deletion plugin.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
24 changes: 24 additions & 0 deletions spec/lib/process_transition_legacy_action_code_spec.rb
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions spec/system/page_objects/pages/process_topic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 18 additions & 0 deletions spec/system/process_topic_banner_spec.rb
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -92,4 +96,18 @@

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")

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)
expect(process_state.reload.process_step_id).to eq(step_2.id)
end
end