Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Allow subscribing to a plan when exceeding its pageview limit on the new upgrade page (#3481)

RobertJoonas8f26b9a034b6
diff --git a/lib/plausible_web/live/choose_plan.ex b/lib/plausible_web/live/choose_plan.ex
index 8c80ca4d87..58a87028ef 100644
--- a/lib/plausible_web/live/choose_plan.ex
+++ b/lib/plausible_web/live/choose_plan.ex
@@ -303,7 +303,10 @@ defmodule PlausibleWeb.Live.ChoosePlan do
paddle_product_id = get_paddle_product_id(assigns.plan_to_render, assigns.selected_interval)
change_plan_link_text = change_plan_link_text(assigns)
- exceeds_some_limit = Quota.exceeded_limits(assigns.usage, assigns.plan_to_render) != []
+ exceeded_limits = Quota.exceeded_limits(assigns.usage, assigns.plan_to_render)
+
+ usage_exceeds_plan_limits =
+ Enum.any?([:team_member_limit, :site_limit], &(&1 in exceeded_limits))
billing_details_expired =
assigns.user.subscription &&
@@ -317,7 +320,7 @@ defmodule PlausibleWeb.Live.ChoosePlan do
change_plan_link_text == "Currently on this plan" ->
{true, nil}
- assigns.available && exceeds_some_limit ->
+ assigns.available && usage_exceeds_plan_limits ->
{true, "Your usage exceeds this plan"}
billing_details_expired ->
diff --git a/test/plausible_web/live/choose_plan_test.exs b/test/plausible_web/live/choose_plan_test.exs
index 1c2e75058e..a2cc24dbc9 100644
--- a/test/plausible_web/live/choose_plan_test.exs
+++ b/test/plausible_web/live/choose_plan_test.exs
@@ -203,23 +203,6 @@ defmodule PlausibleWeb.Live.ChoosePlanTest do
@v4_business_5m_monthly_plan_id
end
- test "checkout is disabled when pageview usage exceeds rendered plan limit", %{
- conn: conn,
- user: user
- } do
- site = insert(:site, members: [user])
- generate_usage_for(site, 10_001)
-
- {:ok, lv, _doc} = get_liveview(conn)
-
- doc = lv |> element(@slider_input) |> render_change(%{slider: 0})
-
- assert text_of_element(doc, @growth_plan_box) =~ "Your usage exceeds this plan"
- assert class_of_element(doc, @growth_checkout_button) =~ "pointer-events-none"
- assert text_of_element(doc, @business_plan_box) =~ "Your usage exceeds this plan"
- assert class_of_element(doc, @business_checkout_button) =~ "pointer-events-none"
- end
-
test "warns about losing access to a feature", %{conn: conn, user: user} do
site = insert(:site, members: [user])
Plausible.Props.allow(site, ["author"])