FIX: Campaign banner should link to pricing table when enabled (#212)
If the new pricing table is enabled the campaign banner should link to the pricing table route.
This commit is contained in:
parent
512f37a1d3
commit
542af4cf16
|
@ -36,7 +36,7 @@
|
|||
</LinkTo>
|
||||
{{else}}
|
||||
<LinkTo
|
||||
@route="subscribe"
|
||||
@route={{this.subscribeRoute}}
|
||||
class="btn btn-primary campaign-banner-info-button"
|
||||
>
|
||||
{{d-icon "far-heart"}}
|
||||
|
|
|
@ -32,6 +32,7 @@ export default Component.extend({
|
|||
amountRaised: setting("discourse_subscriptions_campaign_amount_raised"),
|
||||
goalTarget: setting("discourse_subscriptions_campaign_goal"),
|
||||
product: setting("discourse_subscriptions_campaign_product"),
|
||||
pricingTableEnabled: setting("discourse_subscriptions_pricing_table_enabled"),
|
||||
showContributors: setting(
|
||||
"discourse_subscriptions_campaign_show_contributors"
|
||||
),
|
||||
|
@ -126,7 +127,8 @@ export default Component.extend({
|
|||
const showOnRoute =
|
||||
currentRoute !== "discovery.s" &&
|
||||
!currentRoute.split(".")[0].includes("admin") &&
|
||||
currentRoute.split(".")[0] !== "subscribe";
|
||||
currentRoute.split(".")[0] !== "subscribe" &&
|
||||
currentRoute.split(".")[0] !== "subscriptions";
|
||||
|
||||
if (!this.site.show_campaign_banner) {
|
||||
return false;
|
||||
|
@ -166,6 +168,14 @@ export default Component.extend({
|
|||
);
|
||||
},
|
||||
|
||||
@discourseComputed
|
||||
subscribeRoute() {
|
||||
if (this.pricingTableEnabled) {
|
||||
return "subscriptions";
|
||||
}
|
||||
return "subscribe";
|
||||
},
|
||||
|
||||
@discourseComputed
|
||||
isGoalMet() {
|
||||
const currentVolume = this.subscriberGoal
|
||||
|
|
|
@ -40,6 +40,16 @@ RSpec.describe "Pricing Table", type: :system, js: true do
|
|||
expect(uri.path).to eq("/s/subscriptions")
|
||||
end
|
||||
|
||||
it "Links to the pricing table page from the campaign banner" do
|
||||
sign_in(admin)
|
||||
SiteSetting.discourse_subscriptions_campaign_enabled = true
|
||||
visit("/")
|
||||
|
||||
link = find(".campaign-banner-info-button")
|
||||
uri = URI.parse(link[:href])
|
||||
expect(uri.path).to eq("/s/subscriptions")
|
||||
end
|
||||
|
||||
it "Links to the old page when disabled" do
|
||||
sign_in(admin)
|
||||
SiteSetting.discourse_subscriptions_pricing_table_enabled = false
|
||||
|
@ -50,6 +60,17 @@ RSpec.describe "Pricing Table", type: :system, js: true do
|
|||
expect(uri.path).to eq("/s")
|
||||
end
|
||||
|
||||
it "Links to the old page from the campaign banner when disabled" do
|
||||
sign_in(admin)
|
||||
SiteSetting.discourse_subscriptions_pricing_table_enabled = false
|
||||
SiteSetting.discourse_subscriptions_campaign_enabled = true
|
||||
visit("/")
|
||||
|
||||
link = find(".campaign-banner-info-button")
|
||||
uri = URI.parse(link[:href])
|
||||
expect(uri.path).to eq("/s")
|
||||
end
|
||||
|
||||
it "Old subscribe page still works when disabled" do
|
||||
sign_in(admin)
|
||||
SiteSetting.discourse_subscriptions_pricing_table_enabled = false
|
||||
|
|
Loading…
Reference in New Issue