diff --git a/assets/javascripts/discourse/components/login-required.js b/assets/javascripts/discourse/components/login-required.js deleted file mode 100644 index fc7682d..0000000 --- a/assets/javascripts/discourse/components/login-required.js +++ /dev/null @@ -1,17 +0,0 @@ -import Component from "@ember/component"; -import cookie from "discourse/lib/cookie"; -import DiscourseURL from "discourse/lib/url"; -import { default as getURL } from "discourse-common/lib/get-url"; - -export default Component.extend({ - classNames: ["login-required", "subscriptions"], - actions: { - createAccount() { - const destinationUrl = window.location.href; - const cookiePath = getURL("/"); - - cookie("destination_url", destinationUrl, { path: cookiePath }); - DiscourseURL.redirectTo("/login"); - }, - }, -}); diff --git a/assets/javascripts/discourse/templates/components/login-required.hbs b/assets/javascripts/discourse/templates/components/login-required.hbs index 21c67ce..59f3de8 100644 --- a/assets/javascripts/discourse/templates/components/login-required.hbs +++ b/assets/javascripts/discourse/templates/components/login-required.hbs @@ -2,7 +2,7 @@ \ No newline at end of file diff --git a/spec/system/subscription_product_spec.rb b/spec/system/subscription_product_spec.rb new file mode 100644 index 0000000..29da4bc --- /dev/null +++ b/spec/system/subscription_product_spec.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +describe "Subscription products", type: :system do + fab!(:admin) { Fabricate(:admin) } + fab!(:product) { Fabricate(:product, external_id: "prod_OiKyO6ZMFCIhQa") } + + before { SiteSetting.discourse_subscriptions_enabled = true } + + it "shows the login modal" do + visit("/s") + + find("button.login-required.subscriptions").click + + expect(page).to have_css(".modal-container .login-modal") + end +end