fix: Non helpful confirmation message after clicking "Cancel" of writing WP comment. Also "Cancel" --> "Dismiss" (WP #62513)

This commit is contained in:
Tomas Hykel
2026-06-10 21:33:38 +00:00
parent 8d1cbe8000
commit 178b686947
4 changed files with 28 additions and 5 deletions
@@ -93,7 +93,7 @@
data: { action: "click->#{editor_stimulus_controller}#closeEditor" }
)
) do
t("button_cancel")
t("activities.work_packages.activity_tab.label_dismiss_comment")
end
end
+2 -1
View File
@@ -52,7 +52,8 @@ en:
commented: "commented"
internal_comment: Internal comment
internal_journal: Internal comments are visible to a limited group of members.
unsaved_changes_confirmation_message: You have unsaved changes. Are you sure you want to close the editor?
label_dismiss_comment: "Dismiss"
unsaved_changes_confirmation_message: "Are you sure you want to dismiss your comment? The text that you have written will be lost."
internal_comment_confirmation:
title: "Make this comment public?"
heading: "Make this comment public?"
@@ -55,7 +55,17 @@ RSpec.describe "Work package activity tab comment editor",
end
end
it "is dismissable via Cancel button" do
it "shows a Dismiss button (not Cancel) for new comments" do
activity_tab.add_comment(text: "Sample text", save: false)
activity_tab.clear_comment
page.within_test_selector("op-work-package-journal-form") do
expect(page).to have_button("Dismiss")
expect(page).to have_no_button("Cancel")
end
end
it "is dismissable via Dismiss button" do
expect_editor_to_be_dismissed do
activity_tab.dismiss_comment_editor_with_cancel_button
end
@@ -80,12 +90,24 @@ RSpec.describe "Work package activity tab comment editor",
end
end
it "requires confirmation to dismiss via Cancel button" do
it "requires confirmation to dismiss via Dismiss button" do
expect_editor_to_be_dismissed_with_confirmation do
activity_tab.dismiss_comment_editor_with_cancel_button
end
end
it "shows the updated confirmation message when dismissing a new comment" do
activity_tab.add_comment(text: "Sample text", save: false)
activity_tab.expect_focus_on_editor
expected_message = "Are you sure you want to dismiss your comment? The text that you have written will be lost."
accept_alert(expected_message) do
activity_tab.dismiss_comment_editor_with_cancel_button
end
expect(page).not_to have_test_selector("op-work-package-journal-form-element")
end
def expect_editor_to_be_dismissed_with_confirmation(&)
activity_tab.add_comment(text: "Sample text", save: false)
@@ -355,7 +355,7 @@ module Components
def dismiss_comment_editor_with_cancel_button
page.within_test_selector("op-work-package-journal-form") do
click_on "Cancel"
click_on "Dismiss"
end
end