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

Fix rendering flash messages on create success

Alexander Brandon Coles8bd9620534ea
diff --git a/app/components/projects/new_component.html.erb b/app/components/projects/new_component.html.erb
index 748b31cd8d2..2538d1b775e 100644
--- a/app/components/projects/new_component.html.erb
+++ b/app/components/projects/new_component.html.erb
@@ -36,11 +36,9 @@ See COPYRIGHT and LICENSE files for more details.
turbo_action: :replace,
autoscroll_block: :start,
autoscroll_behavior: :smooth
- }
+ },
+ target: "_top"
) do
-%>
- <%= render_flash_messages_as_turbo_streams %>
- <%=
settings_primer_form_with(model: project) do |f|
flex_layout do |container|
container.with_row(mb: 3) do
@@ -68,5 +66,5 @@ See COPYRIGHT and LICENSE files for more details.
end
end
end
- %>
-<% end %>
+ end
+%>
diff --git a/app/components/projects/new_component.rb b/app/components/projects/new_component.rb
index f8067c9393f..1b2cf4d418c 100644
--- a/app/components/projects/new_component.rb
+++ b/app/components/projects/new_component.rb
@@ -33,7 +33,6 @@ module Projects
include ApplicationHelper
include OpPrimer::ComponentHelpers
include OpTurbo::Streamable
- include FlashMessagesHelper
options :project, :template, :copy_options
end
diff --git a/spec/features/projects/create_spec.rb b/spec/features/projects/create_spec.rb
index c102fd57f46..eacca1e92b3 100644
--- a/spec/features/projects/create_spec.rb
+++ b/spec/features/projects/create_spec.rb
@@ -62,6 +62,8 @@ RSpec.describe "Projects", "creation",
fill_in "Name", with: "Foo bar"
click_on "Create"
+ expect_and_dismiss_flash type: :success, message: "Successful creation."
+
expect(page).to have_current_path /\/projects\/foo-bar\/?/
expect(page).to have_content "Foo bar"
end
@@ -74,6 +76,8 @@ RSpec.describe "Projects", "creation",
fill_in "Name", with: "Foo project"
click_on "Create"
+ expect_and_dismiss_flash type: :success, message: "Successful creation."
+
expect(page).to have_current_path /\/projects\/foo-project-1\/?/
project = Project.last
@@ -107,6 +111,8 @@ RSpec.describe "Projects", "creation",
click_on "Create"
+ expect_and_dismiss_flash type: :success, message: "Successful creation."
+
expect(page).to have_current_path /\/projects\/foo-bar\/?/
expect(page).to have_content "Foo bar"
@@ -164,6 +170,8 @@ RSpec.describe "Projects", "creation",
click_on "Create"
+ expect_and_dismiss_flash type: :success, message: "Successful creation."
+
expect(page).to have_current_path /\/projects\/foo-bar\/?/
expect(page).to have_content "Foo bar"
@@ -253,6 +261,8 @@ RSpec.describe "Projects", "creation",
it "enables custom fields with provided values for this project" do
click_on "Create"
+ expect_and_dismiss_flash type: :success, message: "Successful creation."
+
expect(page).to have_current_path /\/projects\/foo-bar\/?/
project = Project.last
@@ -276,6 +286,8 @@ RSpec.describe "Projects", "creation",
# don't touch the default value
click_on "Create"
+ expect_and_dismiss_flash type: :success, message: "Successful creation."
+
expect(page).to have_current_path /\/projects\/foo-bar\/?/
project = Project.last
@@ -295,6 +307,8 @@ RSpec.describe "Projects", "creation",
expect(page).to have_current_path /\/projects\/foo-bar\/?/
+ expect_and_dismiss_flash type: :success, message: "Successful creation."
+
project = Project.last
# custom_field_with_default_value should be activated and contain the overwritten value
@@ -322,6 +336,8 @@ RSpec.describe "Projects", "creation",
click_on "Create"
+ expect_and_dismiss_flash type: :success, message: "Successful creation."
+
expect(page).to have_current_path /\/projects\/foo-bar\/?/
project = Project.last
@@ -344,6 +360,8 @@ RSpec.describe "Projects", "creation",
click_on "Create"
+ expect_and_dismiss_flash type: :success, message: "Successful creation."
+
expect(page).to have_current_path /\/projects\/foo-bar\/?/
project = Project.last
diff --git a/spec/features/projects/subproject_creation_spec.rb b/spec/features/projects/subproject_creation_spec.rb
index 6d08b48560c..fe6057cf3e6 100644
--- a/spec/features/projects/subproject_creation_spec.rb
+++ b/spec/features/projects/subproject_creation_spec.rb
@@ -69,6 +69,8 @@ RSpec.describe "Subproject creation", :js do
click_on "Create"
+ expect_and_dismiss_flash type: :success, message: "Successful creation."
+
expect(page).to have_current_path /\/projects\/foo-child\/?/
child = Project.last