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

Remove iframe on close of the dialog

Oliver Güntherd62f00189740
diff --git a/app/components/enterprise_trials/welcome_dialog_component.html.erb b/app/components/enterprise_trials/welcome_dialog_component.html.erb
index 0e7cb47f152..6ad87db8116 100644
--- a/app/components/enterprise_trials/welcome_dialog_component.html.erb
+++ b/app/components/enterprise_trials/welcome_dialog_component.html.erb
@@ -4,10 +4,10 @@
id: "enterprise-trial-welcome-dialog",
data: {
"application-target": "dynamic",
- controller: "auto-show-dialog"
+ controller: "auto-show-dialog iframe-media-dialog"
},
title: I18n.t("ee.trial.welcome_title"),
- size: :large
+ size: :xlarge
)
) do |dialog|
dialog.with_header(variant: :large)
diff --git a/app/controllers/enterprise_tokens_controller.rb b/app/controllers/enterprise_tokens_controller.rb
index 98049054ced..53603ee0339 100644
--- a/app/controllers/enterprise_tokens_controller.rb
+++ b/app/controllers/enterprise_tokens_controller.rb
@@ -118,7 +118,6 @@ class EnterpriseTokensController < ApplicationController
end
def check_trial_status
- token_saved_flash
@trial_key = Token::EnterpriseTrialKey.find_by(user_id: User.system.id)
return if @trial_key.nil?
diff --git a/frontend/src/stimulus/controllers/dynamic/iframe-media-dialog.controller.ts b/frontend/src/stimulus/controllers/dynamic/iframe-media-dialog.controller.ts
new file mode 100644
index 00000000000..b1d11adf9e4
--- /dev/null
+++ b/frontend/src/stimulus/controllers/dynamic/iframe-media-dialog.controller.ts
@@ -0,0 +1,40 @@
+/*
+ * -- copyright
+ * OpenProject is an open source project management software.
+ * Copyright (C) the OpenProject GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 3.
+ *
+ * OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+ * Copyright (C) 2006-2013 Jean-Philippe Lang
+ * Copyright (C) 2010-2013 the ChiliProject Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * See COPYRIGHT and LICENSE files for more details.
+ * ++
+ */
+
+import { Controller } from '@hotwired/stimulus';
+
+export default class AutoShowDialogController extends Controller<HTMLDialogElement> {
+ connect() {
+ // Remove the iframe element on close to prevent background play
+ this.element.addEventListener('close', () => {
+ this.element.querySelector('iframe')?.remove();
+ });
+ }
+}
diff --git a/spec/features/admin/enterprise/enterprise_trial_spec.rb b/spec/features/admin/enterprise/enterprise_trial_spec.rb
index 04214afa095..12db9dab510 100644
--- a/spec/features/admin/enterprise/enterprise_trial_spec.rb
+++ b/spec/features/admin/enterprise/enterprise_trial_spec.rb
@@ -258,6 +258,9 @@ RSpec.describe "Enterprise trial management",
visit enterprise_tokens_path
+ expect(page).to have_text("Quick feature overview")
+ expect(page).to have_css("#enterprise-trial-welcome-dialog iframe")
+
expect(page).to have_text("Enterprise Plan (Token Version 1)")
expect(page).to have_text("OpenProject Test")
expect(page).to have_text("5")
@@ -272,7 +275,13 @@ RSpec.describe "Enterprise trial management",
stub_request(:get, "https://start.openproject-edge.com:443/public/v1/trials/#{trial_id}")
.to_return(status: 202, headers: { "Content-Type" => "application/json" }, body: confirmed_body.to_json)
- click_link_or_button("Resend confirmation email")
+ # Expect flash with resend link
+ page.within("#primerized-flash-messages") do
+ click_link_or_button("Resend confirmation email")
+ end
+
+ expect(page).to have_text("Quick feature overview")
+ expect(page).to have_css("#enterprise-trial-welcome-dialog iframe")
expect(page).to have_text("Enterprise Plan (Token Version 1)")
expect(page).to have_text("OpenProject Test")