mirror of
https://github.com/plausible/analytics.git
synced 2024-09-11 18:07:33 +03:00
Allow subscribing to a plan when exceeding its pageview limit on the new upgrade page (#3481)
* still allow subscribing to a plan when exceeding its pageview limit * format
This commit is contained in:
parent
08bd10614f
commit
8f26b9a034
@ -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 ->
|
||||
|
@ -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"])
|
||||
|
Loading…
Reference in New Issue
Block a user