From 3c76053c3fcd3d6b30efbfd1159ed275e93d901c Mon Sep 17 00:00:00 2001 From: RobertJoonas <56999674+RobertJoonas@users.noreply.github.com> Date: Mon, 30 Oct 2023 17:06:51 +0000 Subject: [PATCH] ignore only pv limit exceeded on subscribe (#3470) --- lib/plausible/billing/quota.ex | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/plausible/billing/quota.ex b/lib/plausible/billing/quota.ex index b429524cd..cc5c6f37c 100644 --- a/lib/plausible/billing/quota.ex +++ b/lib/plausible/billing/quota.ex @@ -190,8 +190,17 @@ defmodule Plausible.Billing.Quota do def ensure_can_subscribe_to_plan(user, %Plan{} = plan) do case exceeded_limits(usage(user), plan) do - [] -> :ok - exceeded_limits -> {:error, %{exceeded_limits: exceeded_limits}} + [] -> + :ok + + [:monthly_pageview_limit] -> + # This is a quick fix. Need to figure out how to handle this case. Only + # checking the last 30 days usage is not accurate enough. Needs to be + # in sync with the actual locking system. + :ok + + exceeded_limits -> + {:error, %{exceeded_limits: exceeded_limits}} end end