remove wrong FF condition (#3417)

pull/3422/head r2023.10.12-210
RobertJoonas 3 years ago committed by GitHub
parent c0fe2a3996
commit 313bfa0558
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -51,42 +51,38 @@ defmodule PlausibleWeb.BillingController do
def upgrade_to_enterprise_plan(conn, _params) do
user = Plausible.Users.with_subscription(conn.assigns.current_user)
if FunWithFlags.enabled?(:business_tier, for: user) do
{latest_enterprise_plan, price} = Plans.latest_enterprise_plan_with_price(user)
subscription_resumable? = Plausible.Billing.Subscriptions.resumable?(user.subscription)
subscribed_to_latest? =
subscription_resumable? &&
user.subscription.paddle_plan_id == latest_enterprise_plan.paddle_plan_id
cond do
user.subscription &&
user.subscription.status in [
Subscription.Status.past_due(),
Subscription.Status.paused()
] ->
redirect(conn, to: Routes.auth_path(conn, :user_settings))
subscribed_to_latest? ->
render(conn, "change_enterprise_plan_contact_us.html",
skip_plausible_tracking: true,
layout: {PlausibleWeb.LayoutView, "focus.html"}
)
true ->
render(conn, "upgrade_to_enterprise_plan.html",
user: user,
latest_enterprise_plan: latest_enterprise_plan,
price: price,
subscription_resumable: subscription_resumable?,
contact_link: "https://plausible.io/contact",
skip_plausible_tracking: true,
layout: {PlausibleWeb.LayoutView, "focus.html"}
)
end
else
render_error(conn, 404)
{latest_enterprise_plan, price} = Plans.latest_enterprise_plan_with_price(user)
subscription_resumable? = Plausible.Billing.Subscriptions.resumable?(user.subscription)
subscribed_to_latest? =
subscription_resumable? &&
user.subscription.paddle_plan_id == latest_enterprise_plan.paddle_plan_id
cond do
user.subscription &&
user.subscription.status in [
Subscription.Status.past_due(),
Subscription.Status.paused()
] ->
redirect(conn, to: Routes.auth_path(conn, :user_settings))
subscribed_to_latest? ->
render(conn, "change_enterprise_plan_contact_us.html",
skip_plausible_tracking: true,
layout: {PlausibleWeb.LayoutView, "focus.html"}
)
true ->
render(conn, "upgrade_to_enterprise_plan.html",
user: user,
latest_enterprise_plan: latest_enterprise_plan,
price: price,
subscription_resumable: subscription_resumable?,
contact_link: "https://plausible.io/contact",
skip_plausible_tracking: true,
layout: {PlausibleWeb.LayoutView, "focus.html"}
)
end
end

Loading…
Cancel
Save