Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

bug/63637 After clicking on "Make public" once, subsequent "cancel" actions do not retain the "Internal comment" checked state (#18737)

Kabiru Mwenjabddb7055bbeb
diff --git a/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/internal-comment.controller.ts b/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/internal-comment.controller.ts
index fc600773792..5193896780b 100644
--- a/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/internal-comment.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/internal-comment.controller.ts
@@ -130,6 +130,7 @@ export default class InternalCommentController extends Controller {
}
private askForConfirmation():Promise<boolean> {
+ this.confirmationDialogTarget.returnValue = ''; // Reset the return value on every confirmation dialog
this.confirmationDialogTarget.showModal();
return new Promise((resolve) => {
diff --git a/spec/features/activities/work_package/internal_comments_spec.rb b/spec/features/activities/work_package/internal_comments_spec.rb
index 6e1e2efb42f..2118eebcf47 100644
--- a/spec/features/activities/work_package/internal_comments_spec.rb
+++ b/spec/features/activities/work_package/internal_comments_spec.rb
@@ -289,14 +289,14 @@ RSpec.describe "Work package internal comments",
end
describe "making internal comments public" do
- context "when the user unchecks the 'internal comment' checkbox" do
- current_user { project_admin }
+ current_user { project_admin }
- before do
- wp_page.visit!
- wp_page.wait_for_activity_tab
- end
+ before do
+ wp_page.visit!
+ wp_page.wait_for_activity_tab
+ end
+ context "when the user unchecks the 'internal comment' checkbox" do
it "asks for explicit confirmation from the user" do
activity_tab.open_new_comment_editor
@@ -331,5 +331,32 @@ RSpec.describe "Work package internal comments",
end
end
end
+
+ context "when the user goes through multiple confirmations" do
+ it "retains the correct state" do
+ activity_tab.open_new_comment_editor
+ activity_tab.type_comment("This is an internal comment")
+ activity_tab.check_internal_comment_checkbox
+
+ aggregate_failures "check and confirm" do
+ activity_tab.uncheck_internal_comment_checkbox
+
+ activity_tab.expect_internal_comment_confirmation_dialog do
+ click_on "Make public"
+ end
+ activity_tab.expect_internal_comment_unchecked
+ end
+
+ aggregate_failures "check, uncheck then cancel" do
+ activity_tab.check_internal_comment_checkbox
+ activity_tab.uncheck_internal_comment_checkbox
+
+ activity_tab.expect_internal_comment_confirmation_dialog do
+ click_on "Cancel"
+ end
+ activity_tab.expect_internal_comment_checked
+ end
+ end
+ end
end
end