mirror of
https://github.com/plausible/analytics.git
synced 2024-12-22 09:01:40 +03:00
431c02ad58
* #332: Refactor stats controller * Simplify the conditional logic
20 lines
371 B
Elixir
20 lines
371 B
Elixir
defmodule PlausibleWeb.UpgradeBillingPlug do
|
|
import Phoenix.Controller
|
|
use Plausible.Repo
|
|
|
|
def init(options) do
|
|
options
|
|
end
|
|
|
|
def call(conn, _opts) do
|
|
user = conn.assigns[:current_user]
|
|
|
|
if user && Plausible.Billing.needs_to_upgrade?(conn.assigns[:current_user]) do
|
|
conn
|
|
|> redirect(to: "/settings")
|
|
else
|
|
conn
|
|
end
|
|
end
|
|
end
|