From 42c64abe156829cc83b677e7a46d481aa97c380e Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Wed, 17 Aug 2022 13:11:09 +0530 Subject: [PATCH] FEATURE: open create invite modal from the bootstrap notice banner (#17960) --- .../discourse/app/components/bootstrap_mode_notice.js | 11 +++++++++-- .../templates/components/bootstrap-mode-notice.hbs | 2 +- .../tests/acceptance/bootstrap-mode-notice-test.js | 7 +------ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/bootstrap_mode_notice.js b/app/assets/javascripts/discourse/app/components/bootstrap_mode_notice.js index f1328b9eb6a..69914cfa04a 100644 --- a/app/assets/javascripts/discourse/app/components/bootstrap_mode_notice.js +++ b/app/assets/javascripts/discourse/app/components/bootstrap_mode_notice.js @@ -1,9 +1,11 @@ -import GlimmerComponent from "@glimmer/component"; +import Component from "@glimmer/component"; import { htmlSafe } from "@ember/template"; import I18n from "I18n"; import { inject as service } from "@ember/service"; +import { action } from "@ember/object"; +import showModal from "discourse/lib/show-modal"; -export default class BootstrapModeNotice extends GlimmerComponent { +export default class BootstrapModeNotice extends Component { @service siteSettings; @service site; @@ -19,4 +21,9 @@ export default class BootstrapModeNotice extends GlimmerComponent { return htmlSafe(I18n.t(msg, { count: bootstrapModeMinUsers })); } + + @action + inviteUsers() { + showModal("create-invite"); + } } diff --git a/app/assets/javascripts/discourse/app/templates/components/bootstrap-mode-notice.hbs b/app/assets/javascripts/discourse/app/templates/components/bootstrap-mode-notice.hbs index cf23159b968..aa9fb8b0b4c 100644 --- a/app/assets/javascripts/discourse/app/templates/components/bootstrap-mode-notice.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/bootstrap-mode-notice.hbs @@ -4,7 +4,7 @@ {{this.message}}
-
+
{{#if this.site.wizard_required}} {{/if}} diff --git a/app/assets/javascripts/discourse/tests/acceptance/bootstrap-mode-notice-test.js b/app/assets/javascripts/discourse/tests/acceptance/bootstrap-mode-notice-test.js index 5f11ac4d47c..6bbd39f7014 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/bootstrap-mode-notice-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/bootstrap-mode-notice-test.js @@ -26,13 +26,8 @@ acceptance("Bootstrap Mode Notice", function (needs) { ); await click(".bootstrap-invite-button"); - assert.strictEqual( - currentURL(), - "/u/eviltrout/invited/pending", - "it transitions to the invite page" - ); + assert.ok(exists(".create-invite-modal"), "opens create invite modal"); - await visit("/"); await click(".bootstrap-wizard-link"); assert.strictEqual( currentURL(),