Rename internal build symbols (#3942)
* Rename internal build symbols * Rename remaining + add `on_ce` macro cc @ruslandoga
This commit is contained in:
parent
ca25b6c764
commit
d6824de1ad
|
|
@ -51,7 +51,7 @@ jobs:
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
build-args: |
|
build-args: |
|
||||||
MIX_ENV=small
|
MIX_ENV=ce
|
||||||
BUILD_METADATA=${{ steps.meta.outputs.json }}
|
BUILD_METADATA=${{ steps.meta.outputs.json }}
|
||||||
ERL_FLAGS=+JPperf true
|
ERL_FLAGS=+JPperf true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ jobs:
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
build-args: |
|
build-args: |
|
||||||
MIX_ENV=small
|
MIX_ENV=ce
|
||||||
BUILD_METADATA=${{ steps.meta.outputs.json }}
|
BUILD_METADATA=${{ steps.meta.outputs.json }}
|
||||||
ERL_FLAGS=+JMsingle true
|
ERL_FLAGS=+JMsingle true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
mix_env: ["test", "small_test"]
|
mix_env: ["test", "ce_test"]
|
||||||
postgres_image: ["postgres:16"]
|
postgres_image: ["postgres:16"]
|
||||||
test_experimental_reduced_joins: ["0"]
|
test_experimental_reduced_joins: ["0"]
|
||||||
|
|
||||||
|
|
@ -113,7 +113,7 @@ jobs:
|
||||||
MINIO_HOST_FOR_CLICKHOUSE: "172.17.0.1"
|
MINIO_HOST_FOR_CLICKHOUSE: "172.17.0.1"
|
||||||
|
|
||||||
- run: mix test --include slow --max-failures 1 --warnings-as-errors
|
- run: mix test --include slow --max-failures 1 --warnings-as-errors
|
||||||
if: env.MIX_ENV == 'small_test'
|
if: env.MIX_ENV == 'ce_test'
|
||||||
|
|
||||||
static:
|
static:
|
||||||
name: Static checks (format, credo, dialyzer)
|
name: Static checks (format, credo, dialyzer)
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
#### Builder
|
#### Builder
|
||||||
FROM hexpm/elixir:1.16.0-erlang-26.2.1-alpine-3.18.4 as buildcontainer
|
FROM hexpm/elixir:1.16.0-erlang-26.2.1-alpine-3.18.4 as buildcontainer
|
||||||
|
|
||||||
ARG MIX_ENV=small
|
ARG MIX_ENV=ce
|
||||||
|
|
||||||
# preparation
|
# preparation
|
||||||
ENV MIX_ENV=$MIX_ENV
|
ENV MIX_ENV=$MIX_ENV
|
||||||
|
|
@ -60,7 +60,7 @@ LABEL maintainer="plausible.io <hello@plausible.io>"
|
||||||
ARG BUILD_METADATA={}
|
ARG BUILD_METADATA={}
|
||||||
ENV BUILD_METADATA=$BUILD_METADATA
|
ENV BUILD_METADATA=$BUILD_METADATA
|
||||||
ENV LANG=C.UTF-8
|
ENV LANG=C.UTF-8
|
||||||
ARG MIX_ENV=small
|
ARG MIX_ENV=ce
|
||||||
ENV MIX_ENV=$MIX_ENV
|
ENV MIX_ENV=$MIX_ENV
|
||||||
|
|
||||||
RUN adduser -S -H -u 999 -G nogroup plausible -g 'Plausible Analytics'
|
RUN adduser -S -H -u 999 -G nogroup plausible -g 'Plausible Analytics'
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,11 @@ if config_env() in [:dev, :test] do
|
||||||
Envy.load(["config/.env.#{config_env()}"])
|
Envy.load(["config/.env.#{config_env()}"])
|
||||||
end
|
end
|
||||||
|
|
||||||
if config_env() == :small_dev do
|
if config_env() == :ce_dev do
|
||||||
Envy.load(["config/.env.dev"])
|
Envy.load(["config/.env.dev"])
|
||||||
end
|
end
|
||||||
|
|
||||||
if config_env() == :small_test do
|
if config_env() == :ce_test do
|
||||||
Envy.load(["config/.env.test"])
|
Envy.load(["config/.env.test"])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ defmodule Plausible do
|
||||||
Build-related macros
|
Build-related macros
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@small_builds [:small, :small_test, :small_dev]
|
@ce_builds [:ce, :ce_test, :ce_dev]
|
||||||
|
|
||||||
defmacro __using__(_) do
|
defmacro __using__(_) do
|
||||||
quote do
|
quote do
|
||||||
|
|
@ -12,16 +12,42 @@ defmodule Plausible do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defmacro on_full_build(clauses) do
|
defmacro on_ee(clauses) do
|
||||||
do_on_full_build(clauses)
|
do_on_ee(clauses)
|
||||||
end
|
end
|
||||||
|
|
||||||
def do_on_full_build(do: block) do
|
defmacro on_ce(clauses) do
|
||||||
do_on_full_build(do: block, else: nil)
|
do_on_ce(clauses)
|
||||||
end
|
end
|
||||||
|
|
||||||
def do_on_full_build(do: do_block, else: else_block) do
|
defmacro ee?() do
|
||||||
if Mix.env() not in @small_builds do
|
ee? = Mix.env() not in @ce_builds
|
||||||
|
|
||||||
|
# Tricking dialyzer as per:
|
||||||
|
# https://github.com/elixir-lang/elixir/blob/v1.12.3/lib/elixir/lib/gen_server.ex#L771-L778
|
||||||
|
quote do
|
||||||
|
:erlang.phash2(1, 1) == 0 and unquote(ee?)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
defmacro ce?() do
|
||||||
|
ce_build? = Mix.env() in @ce_builds
|
||||||
|
|
||||||
|
quote do
|
||||||
|
unquote(ce_build?)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
defp do_on_ce(do: block) do
|
||||||
|
do_on_ee(do: nil, else: block)
|
||||||
|
end
|
||||||
|
|
||||||
|
defp do_on_ee(do: block) do
|
||||||
|
do_on_ee(do: block, else: nil)
|
||||||
|
end
|
||||||
|
|
||||||
|
defp do_on_ee(do: do_block, else: else_block) do
|
||||||
|
if Mix.env() not in @ce_builds do
|
||||||
quote do
|
quote do
|
||||||
unquote(do_block)
|
unquote(do_block)
|
||||||
end
|
end
|
||||||
|
|
@ -31,22 +57,4 @@ defmodule Plausible do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defmacro full_build?() do
|
|
||||||
full_build? = Mix.env() not in @small_builds
|
|
||||||
|
|
||||||
# Tricking dialyzer as per:
|
|
||||||
# https://github.com/elixir-lang/elixir/blob/v1.12.3/lib/elixir/lib/gen_server.ex#L771-L778
|
|
||||||
quote do
|
|
||||||
:erlang.phash2(1, 1) == 0 and unquote(full_build?)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
defmacro small_build?() do
|
|
||||||
small_build? = Mix.env() in @small_builds
|
|
||||||
|
|
||||||
quote do
|
|
||||||
unquote(small_build?)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ defmodule Plausible.Application do
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
def start(_type, _args) do
|
def start(_type, _args) do
|
||||||
on_full_build(do: Plausible.License.ensure_valid_license())
|
on_ee(do: Plausible.License.ensure_valid_license())
|
||||||
|
|
||||||
children = [
|
children = [
|
||||||
Plausible.Cache.Stats,
|
Plausible.Cache.Stats,
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ defmodule Plausible.Auth do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
def is_super_admin?(nil), do: false
|
def is_super_admin?(nil), do: false
|
||||||
def is_super_admin?(%Plausible.Auth.User{id: id}), do: is_super_admin?(id)
|
def is_super_admin?(%Plausible.Auth.User{id: id}), do: is_super_admin?(id)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -252,7 +252,7 @@ defmodule Plausible.Auth.User do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp trial_expiry() do
|
defp trial_expiry() do
|
||||||
on_full_build do
|
on_ee do
|
||||||
Timex.today() |> Timex.shift(days: 30)
|
Timex.today() |> Timex.shift(days: 30)
|
||||||
else
|
else
|
||||||
Timex.today() |> Timex.shift(years: 100)
|
Timex.today() |> Timex.shift(years: 100)
|
||||||
|
|
@ -260,7 +260,7 @@ defmodule Plausible.Auth.User do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp set_email_verification_status(user) do
|
defp set_email_verification_status(user) do
|
||||||
on_full_build do
|
on_ee do
|
||||||
change(user, email_verified: false)
|
change(user, email_verified: false)
|
||||||
else
|
else
|
||||||
selfhosted_config = Application.get_env(:plausible, :selfhost)
|
selfhosted_config = Application.get_env(:plausible, :selfhost)
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ defmodule Plausible.Auth.UserAdmin do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
defp usage_link(user) do
|
defp usage_link(user) do
|
||||||
path = PlausibleWeb.Router.Helpers.admin_path(PlausibleWeb.Endpoint, :usage, user.id)
|
path = PlausibleWeb.Router.Helpers.admin_path(PlausibleWeb.Endpoint, :usage, user.id)
|
||||||
{:safe, ~s(<a href="#{path}">Usage</a>)}
|
{:safe, ~s(<a href="#{path}">Usage</a>)}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ defmodule Plausible.Billing.Quota do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
@limit_sites_since ~D[2021-05-05]
|
@limit_sites_since ~D[2021-05-05]
|
||||||
@site_limit_for_trials 10
|
@site_limit_for_trials 10
|
||||||
@team_member_limit_for_trials 3
|
@team_member_limit_for_trials 3
|
||||||
|
|
@ -349,7 +349,7 @@ defmodule Plausible.Billing.Quota do
|
||||||
stats_api_usage = from a in Plausible.Auth.ApiKey, where: a.user_id == ^user.id
|
stats_api_usage = from a in Plausible.Auth.ApiKey, where: a.user_id == ^user.id
|
||||||
|
|
||||||
queries =
|
queries =
|
||||||
on_full_build do
|
on_ee do
|
||||||
funnels_usage_query =
|
funnels_usage_query =
|
||||||
from f in "funnels",
|
from f in "funnels",
|
||||||
inner_join: os in subquery(owned_sites_query(user)),
|
inner_join: os in subquery(owned_sites_query(user)),
|
||||||
|
|
@ -378,7 +378,7 @@ defmodule Plausible.Billing.Quota do
|
||||||
props_exist = is_list(site.allowed_event_props) && site.allowed_event_props != []
|
props_exist = is_list(site.allowed_event_props) && site.allowed_event_props != []
|
||||||
|
|
||||||
funnels_exist =
|
funnels_exist =
|
||||||
on_full_build do
|
on_ee do
|
||||||
Plausible.Repo.exists?(from f in Plausible.Funnel, where: f.site_id == ^site.id)
|
Plausible.Repo.exists?(from f in Plausible.Funnel, where: f.site_id == ^site.id)
|
||||||
else
|
else
|
||||||
false
|
false
|
||||||
|
|
|
||||||
|
|
@ -254,7 +254,7 @@ defmodule Plausible.Exports do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
defp sampled(table, date_range) do
|
defp sampled(table, date_range) do
|
||||||
from(table)
|
from(table)
|
||||||
|> Plausible.Stats.Sampling.add_query_hint()
|
|> Plausible.Stats.Sampling.add_query_hint()
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ defmodule Plausible.Goal do
|
||||||
field :event_name, :string
|
field :event_name, :string
|
||||||
field :page_path, :string
|
field :page_path, :string
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
field :currency, Ecto.Enum, values: Money.Currency.known_current_currencies()
|
field :currency, Ecto.Enum, values: Money.Currency.known_current_currencies()
|
||||||
many_to_many :funnels, Plausible.Funnel, join_through: Plausible.Funnel.Step
|
many_to_many :funnels, Plausible.Funnel, join_through: Plausible.Funnel.Step
|
||||||
else
|
else
|
||||||
|
|
@ -22,7 +22,7 @@ defmodule Plausible.Goal do
|
||||||
timestamps()
|
timestamps()
|
||||||
end
|
end
|
||||||
|
|
||||||
@fields [:id, :site_id, :event_name, :page_path] ++ on_full_build(do: [:currency], else: [])
|
@fields [:id, :site_id, :event_name, :page_path] ++ on_ee(do: [:currency], else: [])
|
||||||
|
|
||||||
def changeset(goal, attrs \\ %{}) do
|
def changeset(goal, attrs \\ %{}) do
|
||||||
goal
|
goal
|
||||||
|
|
@ -77,7 +77,7 @@ defmodule Plausible.Goal do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp maybe_drop_currency(changeset) do
|
defp maybe_drop_currency(changeset) do
|
||||||
if full_build?() and get_field(changeset, :page_path) do
|
if ee?() and get_field(changeset, :page_path) do
|
||||||
delete_change(changeset, :currency)
|
delete_change(changeset, :currency)
|
||||||
else
|
else
|
||||||
changeset
|
changeset
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ defmodule Plausible.Goals do
|
||||||
Repo.transaction(fn ->
|
Repo.transaction(fn ->
|
||||||
case insert_goal(site, params, upsert?) do
|
case insert_goal(site, params, upsert?) do
|
||||||
{:ok, :insert, goal} ->
|
{:ok, :insert, goal} ->
|
||||||
on_full_build do
|
on_ee do
|
||||||
now = Keyword.get(opts, :now, DateTime.utc_now())
|
now = Keyword.get(opts, :now, DateTime.utc_now())
|
||||||
# credo:disable-for-next-line Credo.Check.Refactor.Nesting
|
# credo:disable-for-next-line Credo.Check.Refactor.Nesting
|
||||||
if Plausible.Goal.Revenue.revenue?(goal) do
|
if Plausible.Goal.Revenue.revenue?(goal) do
|
||||||
|
|
@ -103,7 +103,7 @@ defmodule Plausible.Goals do
|
||||||
order_by: [desc: g.id],
|
order_by: [desc: g.id],
|
||||||
preload: [:site]
|
preload: [:site]
|
||||||
|
|
||||||
if opts[:preload_funnels?] == true and full_build?() do
|
if opts[:preload_funnels?] == true and ee?() do
|
||||||
from(g in query,
|
from(g in query,
|
||||||
left_join: assoc(g, :funnels),
|
left_join: assoc(g, :funnels),
|
||||||
group_by: g.id,
|
group_by: g.id,
|
||||||
|
|
@ -136,7 +136,7 @@ defmodule Plausible.Goals do
|
||||||
where: g.site_id == ^site_id
|
where: g.site_id == ^site_id
|
||||||
)
|
)
|
||||||
|
|
||||||
goal_query = on_full_build(do: preload(goal_query, funnels: :steps), else: goal_query)
|
goal_query = on_ee(do: preload(goal_query, funnels: :steps), else: goal_query)
|
||||||
|
|
||||||
result =
|
result =
|
||||||
Multi.new()
|
Multi.new()
|
||||||
|
|
|
||||||
|
|
@ -292,7 +292,7 @@ defmodule Plausible.Ingestion.Event do
|
||||||
defp put_props(%__MODULE__{} = event), do: event
|
defp put_props(%__MODULE__{} = event), do: event
|
||||||
|
|
||||||
defp put_revenue(event) do
|
defp put_revenue(event) do
|
||||||
on_full_build do
|
on_ee do
|
||||||
attrs = Plausible.Ingestion.Event.Revenue.get_revenue_attrs(event)
|
attrs = Plausible.Ingestion.Event.Revenue.get_revenue_attrs(event)
|
||||||
update_event_attrs(event, attrs)
|
update_event_attrs(event, attrs)
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ defmodule Plausible.Ingestion.Request do
|
||||||
field :pathname, :string
|
field :pathname, :string
|
||||||
field :props, :map
|
field :props, :map
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
field :revenue_source, :map
|
field :revenue_source, :map
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -95,7 +95,7 @@ defmodule Plausible.Ingestion.Request do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
defp put_revenue_source(changeset, request_body) do
|
defp put_revenue_source(changeset, request_body) do
|
||||||
Plausible.Ingestion.Request.Revenue.put_revenue_source(changeset, request_body)
|
Plausible.Ingestion.Request.Revenue.put_revenue_source(changeset, request_body)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ defmodule Plausible.Plugins.API.Token do
|
||||||
can scan repositories for accidental secret commits.
|
can scan repositories for accidental secret commits.
|
||||||
"""
|
"""
|
||||||
def prefix() do
|
def prefix() do
|
||||||
on_full_build do
|
on_ee do
|
||||||
env = Application.get_env(:plausible, :environment)
|
env = Application.get_env(:plausible, :environment)
|
||||||
|
|
||||||
case env do
|
case env do
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ defmodule Plausible.S3 do
|
||||||
|
|
||||||
# to make ClickHouse see MinIO in dev and test envs we replace
|
# to make ClickHouse see MinIO in dev and test envs we replace
|
||||||
# the host in the S3 URL with host.docker.internal or whatever's set in $MINIO_HOST_FOR_CLICKHOUSE
|
# the host in the S3 URL with host.docker.internal or whatever's set in $MINIO_HOST_FOR_CLICKHOUSE
|
||||||
if Mix.env() in [:dev, :test, :small_dev, :small_test] do
|
if Mix.env() in [:dev, :test, :ce_dev, :ce_test] do
|
||||||
defp extract_s3_url(presigned_url) do
|
defp extract_s3_url(presigned_url) do
|
||||||
[s3_url, _] = String.split(presigned_url, "?")
|
[s3_url, _] = String.split(presigned_url, "?")
|
||||||
default_ch_host = unless System.get_env("CI"), do: "host.docker.internal"
|
default_ch_host = unless System.get_env("CI"), do: "host.docker.internal"
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitation do
|
||||||
|> downgrade_previous_owner(site, user)
|
|> downgrade_previous_owner(site, user)
|
||||||
|> Multi.insert_or_update(:membership, membership)
|
|> Multi.insert_or_update(:membership, membership)
|
||||||
|> Multi.run(:update_locked_sites, fn _, _ ->
|
|> Multi.run(:update_locked_sites, fn _, _ ->
|
||||||
on_full_build do
|
on_ee do
|
||||||
# At this point this function should be guaranteed to unlock
|
# At this point this function should be guaranteed to unlock
|
||||||
# the site, via `Invitations.ensure_can_take_ownership/2`.
|
# the site, via `Invitations.ensure_can_take_ownership/2`.
|
||||||
:unlocked = Billing.SiteLocker.update_sites_for(user, send_email?: false)
|
:unlocked = Billing.SiteLocker.update_sites_for(user, send_email?: false)
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ defmodule Plausible.Site.Memberships.Invitations do
|
||||||
:ok
|
:ok
|
||||||
end
|
end
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
@spec ensure_can_take_ownership(Site.t(), Auth.User.t()) ::
|
@spec ensure_can_take_ownership(Site.t(), Auth.User.t()) ::
|
||||||
:ok | {:error, Quota.over_limits_error() | :no_plan}
|
:ok | {:error, Quota.over_limits_error() | :no_plan}
|
||||||
def ensure_can_take_ownership(site, new_owner) do
|
def ensure_can_take_ownership(site, new_owner) do
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ defmodule Plausible.Stats do
|
||||||
CurrentVisitors.current_visitors(site)
|
CurrentVisitors.current_visitors(site)
|
||||||
end
|
end
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
def funnel(site, query, funnel) do
|
def funnel(site, query, funnel) do
|
||||||
include_sentry_replay_info()
|
include_sentry_replay_info()
|
||||||
Plausible.Stats.Funnel.funnel(site, query, funnel)
|
Plausible.Stats.Funnel.funnel(site, query, funnel)
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ defmodule Plausible.Stats.Aggregate do
|
||||||
|
|
||||||
def aggregate(site, query, metrics) do
|
def aggregate(site, query, metrics) do
|
||||||
{currency, metrics} =
|
{currency, metrics} =
|
||||||
on_full_build do
|
on_ee do
|
||||||
Plausible.Stats.Goal.Revenue.get_revenue_tracking_currency(site, query, metrics)
|
Plausible.Stats.Goal.Revenue.get_revenue_tracking_currency(site, query, metrics)
|
||||||
else
|
else
|
||||||
{nil, metrics}
|
{nil, metrics}
|
||||||
|
|
@ -200,7 +200,7 @@ defmodule Plausible.Stats.Aggregate do
|
||||||
|
|
||||||
defp maybe_round_value(entry), do: entry
|
defp maybe_round_value(entry), do: entry
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
defp cast_revenue_metrics_to_money(results, revenue_goals) do
|
defp cast_revenue_metrics_to_money(results, revenue_goals) do
|
||||||
Plausible.Stats.Goal.Revenue.cast_revenue_metrics_to_money(results, revenue_goals)
|
Plausible.Stats.Goal.Revenue.cast_revenue_metrics_to_money(results, revenue_goals)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ defmodule Plausible.Stats.Base do
|
||||||
where: e.timestamp >= ^first_datetime and e.timestamp < ^last_datetime
|
where: e.timestamp >= ^first_datetime and e.timestamp < ^last_datetime
|
||||||
)
|
)
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
q = Plausible.Stats.Sampling.add_query_hint(q, query)
|
q = Plausible.Stats.Sampling.add_query_hint(q, query)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -142,7 +142,7 @@ defmodule Plausible.Stats.Base do
|
||||||
from s in q, where: s.start >= ^first_datetime and s.start < ^last_datetime
|
from s in q, where: s.start >= ^first_datetime and s.start < ^last_datetime
|
||||||
end
|
end
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
sessions_q = Plausible.Stats.Sampling.add_query_hint(sessions_q, query)
|
sessions_q = Plausible.Stats.Sampling.add_query_hint(sessions_q, query)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -254,7 +254,7 @@ defmodule Plausible.Stats.Base do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
defp select_event_metric(:total_revenue) do
|
defp select_event_metric(:total_revenue) do
|
||||||
%{total_revenue: Plausible.Stats.Goal.Revenue.total_revenue_query()}
|
%{total_revenue: Plausible.Stats.Goal.Revenue.total_revenue_query()}
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ defmodule Plausible.Stats.Breakdown do
|
||||||
|
|
||||||
@session_metrics [:bounce_rate, :visit_duration]
|
@session_metrics [:bounce_rate, :visit_duration]
|
||||||
|
|
||||||
@revenue_metrics on_full_build(do: Plausible.Stats.Goal.Revenue.revenue_metrics(), else: [])
|
@revenue_metrics on_ee(do: Plausible.Stats.Goal.Revenue.revenue_metrics(), else: [])
|
||||||
|
|
||||||
@event_metrics [:visits, :visitors, :pageviews, :events, :percentage] ++ @revenue_metrics
|
@event_metrics [:visits, :visitors, :pageviews, :events, :percentage] ++ @revenue_metrics
|
||||||
|
|
||||||
|
|
@ -38,7 +38,7 @@ defmodule Plausible.Stats.Breakdown do
|
||||||
no_revenue = {nil, metrics -- @revenue_metrics}
|
no_revenue = {nil, metrics -- @revenue_metrics}
|
||||||
|
|
||||||
{revenue_goals, metrics} =
|
{revenue_goals, metrics} =
|
||||||
on_full_build do
|
on_ee do
|
||||||
if Plausible.Billing.Feature.RevenueGoals.enabled?(site) do
|
if Plausible.Billing.Feature.RevenueGoals.enabled?(site) do
|
||||||
revenue_goals = Enum.filter(event_goals, &Plausible.Goal.Revenue.revenue?/1)
|
revenue_goals = Enum.filter(event_goals, &Plausible.Goal.Revenue.revenue?/1)
|
||||||
metrics = if Enum.empty?(revenue_goals), do: metrics -- @revenue_metrics, else: metrics
|
metrics = if Enum.empty?(revenue_goals), do: metrics -- @revenue_metrics, else: metrics
|
||||||
|
|
@ -122,7 +122,7 @@ defmodule Plausible.Stats.Breakdown do
|
||||||
|
|
||||||
def breakdown(site, query, "event:props:" <> custom_prop = property, metrics, pagination, opts) do
|
def breakdown(site, query, "event:props:" <> custom_prop = property, metrics, pagination, opts) do
|
||||||
{currency, metrics} =
|
{currency, metrics} =
|
||||||
on_full_build do
|
on_ee do
|
||||||
Plausible.Stats.Goal.Revenue.get_revenue_tracking_currency(site, query, metrics)
|
Plausible.Stats.Goal.Revenue.get_revenue_tracking_currency(site, query, metrics)
|
||||||
else
|
else
|
||||||
{nil, metrics}
|
{nil, metrics}
|
||||||
|
|
@ -758,7 +758,7 @@ defmodule Plausible.Stats.Breakdown do
|
||||||
])
|
])
|
||||||
end
|
end
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
defp cast_revenue_metrics_to_money(results, revenue_goals) do
|
defp cast_revenue_metrics_to_money(results, revenue_goals) do
|
||||||
Plausible.Stats.Goal.Revenue.cast_revenue_metrics_to_money(results, revenue_goals)
|
Plausible.Stats.Goal.Revenue.cast_revenue_metrics_to_money(results, revenue_goals)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ defmodule Plausible.Stats.Clickhouse do
|
||||||
offset: ^offset
|
offset: ^offset
|
||||||
)
|
)
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
referrers = Plausible.Stats.Sampling.add_query_hint(referrers, 10_000_000)
|
referrers = Plausible.Stats.Sampling.add_query_hint(referrers, 10_000_000)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -193,7 +193,7 @@ defmodule Plausible.Stats.Clickhouse do
|
||||||
order_by: [e.site_id, fragment("toStartOfHour(timestamp)")]
|
order_by: [e.site_id, fragment("toStartOfHour(timestamp)")]
|
||||||
)
|
)
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
current_q = Plausible.Stats.Sampling.add_query_hint(current_q)
|
current_q = Plausible.Stats.Sampling.add_query_hint(current_q)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -231,7 +231,7 @@ defmodule Plausible.Stats.Clickhouse do
|
||||||
},
|
},
|
||||||
group_by: [e.site_id]
|
group_by: [e.site_id]
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
query = Plausible.Stats.Sampling.add_query_hint(query)
|
query = Plausible.Stats.Sampling.add_query_hint(query)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -260,7 +260,7 @@ defmodule Plausible.Stats.Clickhouse do
|
||||||
where: e.timestamp >= ^first_datetime and e.timestamp < ^last_datetime
|
where: e.timestamp >= ^first_datetime and e.timestamp < ^last_datetime
|
||||||
)
|
)
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
q = Plausible.Stats.Sampling.add_query_hint(q, 10_000_000)
|
q = Plausible.Stats.Sampling.add_query_hint(q, 10_000_000)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ defmodule Plausible.Stats.Metrics do
|
||||||
:events,
|
:events,
|
||||||
:conversion_rate,
|
:conversion_rate,
|
||||||
:time_on_page
|
:time_on_page
|
||||||
] ++ on_full_build(do: Plausible.Stats.Goal.Revenue.revenue_metrics(), else: [])
|
] ++ on_ee(do: Plausible.Stats.Goal.Revenue.revenue_metrics(), else: [])
|
||||||
|
|
||||||
@metric_mappings Enum.into(@all_metrics, %{}, fn metric -> {to_string(metric), metric} end)
|
@metric_mappings Enum.into(@all_metrics, %{}, fn metric -> {to_string(metric), metric} end)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ defmodule Plausible.Stats.Query do
|
||||||
|> put_imported_opts(site, params)
|
|> put_imported_opts(site, params)
|
||||||
|> maybe_drop_prop_filter(site)
|
|> maybe_drop_prop_filter(site)
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
query = Plausible.Stats.Sampling.put_threshold(query, params)
|
query = Plausible.Stats.Sampling.put_threshold(query, params)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ defmodule Plausible.Stats.Timeseries do
|
||||||
Plausible.Stats.TableDecider.partition_metrics(metrics, query)
|
Plausible.Stats.TableDecider.partition_metrics(metrics, query)
|
||||||
|
|
||||||
{currency, event_metrics} =
|
{currency, event_metrics} =
|
||||||
on_full_build do
|
on_ee do
|
||||||
Plausible.Stats.Goal.Revenue.get_revenue_tracking_currency(site, query, event_metrics)
|
Plausible.Stats.Goal.Revenue.get_revenue_tracking_currency(site, query, event_metrics)
|
||||||
else
|
else
|
||||||
{nil, event_metrics}
|
{nil, event_metrics}
|
||||||
|
|
@ -245,7 +245,7 @@ defmodule Plausible.Stats.Timeseries do
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
defp cast_revenue_metrics_to_money(results, revenue_goals) do
|
defp cast_revenue_metrics_to_money(results, revenue_goals) do
|
||||||
Plausible.Stats.Goal.Revenue.cast_revenue_metrics_to_money(results, revenue_goals)
|
Plausible.Stats.Goal.Revenue.cast_revenue_metrics_to_money(results, revenue_goals)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ defmodule Plausible.Users do
|
||||||
alias Plausible.Repo
|
alias Plausible.Repo
|
||||||
|
|
||||||
@spec on_trial?(Auth.User.t()) :: boolean()
|
@spec on_trial?(Auth.User.t()) :: boolean()
|
||||||
on_full_build do
|
on_ee do
|
||||||
def on_trial?(%Auth.User{trial_expiry_date: nil}), do: false
|
def on_trial?(%Auth.User{trial_expiry_date: nil}), do: false
|
||||||
|
|
||||||
def on_trial?(user) do
|
def on_trial?(user) do
|
||||||
|
|
@ -36,7 +36,7 @@ defmodule Plausible.Users do
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec accept_traffic_until(Auth.User.t()) :: Date.t()
|
@spec accept_traffic_until(Auth.User.t()) :: Date.t()
|
||||||
on_full_build do
|
on_ee do
|
||||||
def accept_traffic_until(user) do
|
def accept_traffic_until(user) do
|
||||||
user = with_subscription(user)
|
user = with_subscription(user)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ defmodule Plausible.Release do
|
||||||
]
|
]
|
||||||
|
|
||||||
def should_be_first_launch? do
|
def should_be_first_launch? do
|
||||||
on_full_build do
|
on_ee do
|
||||||
false
|
false
|
||||||
else
|
else
|
||||||
not (_has_users? = Repo.exists?(Plausible.Auth.User))
|
not (_has_users? = Repo.exists?(Plausible.Auth.User))
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ defmodule PlausibleWeb.Api.StatsController do
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@revenue_metrics on_full_build(do: Plausible.Stats.Goal.Revenue.revenue_metrics(), else: [])
|
@revenue_metrics on_ee(do: Plausible.Stats.Goal.Revenue.revenue_metrics(), else: [])
|
||||||
|
|
||||||
plug(:date_validation_plug)
|
plug(:date_validation_plug)
|
||||||
|
|
||||||
|
|
@ -347,13 +347,13 @@ defmodule PlausibleWeb.Api.StatsController do
|
||||||
top_stats_entry(results, comparison, "Unique visitors", :total_visitors),
|
top_stats_entry(results, comparison, "Unique visitors", :total_visitors),
|
||||||
top_stats_entry(results, comparison, "Unique conversions", :visitors, graphable?: true),
|
top_stats_entry(results, comparison, "Unique conversions", :visitors, graphable?: true),
|
||||||
top_stats_entry(results, comparison, "Total conversions", :events, graphable?: true),
|
top_stats_entry(results, comparison, "Total conversions", :events, graphable?: true),
|
||||||
on_full_build do
|
on_ee do
|
||||||
top_stats_entry(results, comparison, "Average revenue", :average_revenue,
|
top_stats_entry(results, comparison, "Average revenue", :average_revenue,
|
||||||
formatter: &format_money/1,
|
formatter: &format_money/1,
|
||||||
graphable?: true
|
graphable?: true
|
||||||
)
|
)
|
||||||
end,
|
end,
|
||||||
on_full_build do
|
on_ee do
|
||||||
top_stats_entry(results, comparison, "Total revenue", :total_revenue,
|
top_stats_entry(results, comparison, "Total revenue", :total_revenue,
|
||||||
formatter: &format_money/1,
|
formatter: &format_money/1,
|
||||||
graphable?: true
|
graphable?: true
|
||||||
|
|
@ -480,7 +480,7 @@ defmodule PlausibleWeb.Api.StatsController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
def funnel(conn, %{"id" => funnel_id} = params) do
|
def funnel(conn, %{"id" => funnel_id} = params) do
|
||||||
site = Plausible.Repo.preload(conn.assigns.site, :owner)
|
site = Plausible.Repo.preload(conn.assigns.site, :owner)
|
||||||
|
|
||||||
|
|
@ -1377,7 +1377,7 @@ defmodule PlausibleWeb.Api.StatsController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
defdelegate format_revenue_metric(metric_value), to: PlausibleWeb.Controllers.API.Revenue
|
defdelegate format_revenue_metric(metric_value), to: PlausibleWeb.Controllers.API.Revenue
|
||||||
defdelegate format_money(money), to: PlausibleWeb.Controllers.API.Revenue
|
defdelegate format_money(money), to: PlausibleWeb.Controllers.API.Revenue
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -679,7 +679,7 @@ defmodule PlausibleWeb.SiteController do
|
||||||
|> redirect(external: Routes.site_path(conn, :settings_integrations, site.domain))
|
|> redirect(external: Routes.site_path(conn, :settings_integrations, site.domain))
|
||||||
end
|
end
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
# exported archives are downloaded from object storage
|
# exported archives are downloaded from object storage
|
||||||
else
|
else
|
||||||
alias Plausible.Exports
|
alias Plausible.Exports
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ defmodule PlausibleWeb.StatsController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
defp list_funnels(site) do
|
defp list_funnels(site) do
|
||||||
Plausible.Funnels.list(site)
|
Plausible.Funnels.list(site)
|
||||||
end
|
end
|
||||||
|
|
@ -356,7 +356,7 @@ defmodule PlausibleWeb.StatsController do
|
||||||
defp get_flags(_user, _site), do: %{}
|
defp get_flags(_user, _site), do: %{}
|
||||||
|
|
||||||
defp is_dbip() do
|
defp is_dbip() do
|
||||||
on_full_build do
|
on_ee do
|
||||||
false
|
false
|
||||||
else
|
else
|
||||||
Plausible.Geo.database_type()
|
Plausible.Geo.database_type()
|
||||||
|
|
|
||||||
|
|
@ -349,7 +349,7 @@ defmodule PlausibleWeb.Email do
|
||||||
|
|
||||||
def export_success(user, site, download_url, expires_at) do
|
def export_success(user, site, download_url, expires_at) do
|
||||||
subject =
|
subject =
|
||||||
on_full_build do
|
on_ee do
|
||||||
"Your Plausible Analytics export is now ready for download"
|
"Your Plausible Analytics export is now ready for download"
|
||||||
else
|
else
|
||||||
"Your export is now ready for download"
|
"Your export is now ready for download"
|
||||||
|
|
@ -377,7 +377,7 @@ defmodule PlausibleWeb.Email do
|
||||||
|
|
||||||
def export_failure(user, site) do
|
def export_failure(user, site) do
|
||||||
subject =
|
subject =
|
||||||
on_full_build do
|
on_ee do
|
||||||
"Your Plausible Analytics export has failed"
|
"Your Plausible Analytics export has failed"
|
||||||
else
|
else
|
||||||
"Your export has failed"
|
"Your export has failed"
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ defmodule PlausibleWeb.Endpoint do
|
||||||
static_paths = ~w(css js images favicon.ico)
|
static_paths = ~w(css js images favicon.ico)
|
||||||
|
|
||||||
static_paths =
|
static_paths =
|
||||||
on_full_build do
|
on_ee do
|
||||||
# NOTE: The Cloud uses custom robots.txt from https://github.com/plausible/website: https://plausible.io/robots.txt
|
# NOTE: The Cloud uses custom robots.txt from https://github.com/plausible/website: https://plausible.io/robots.txt
|
||||||
static_paths
|
static_paths
|
||||||
else
|
else
|
||||||
|
|
@ -50,7 +50,7 @@ defmodule PlausibleWeb.Endpoint do
|
||||||
only: static_paths
|
only: static_paths
|
||||||
)
|
)
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
plug(Plug.Static,
|
plug(Plug.Static,
|
||||||
at: "/kaffy",
|
at: "/kaffy",
|
||||||
from: :kaffy,
|
from: :kaffy,
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ defmodule PlausibleWeb.Live.GoalSettings.Form do
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
:if={full_build?()}
|
:if={ee?()}
|
||||||
class="mt-6 space-y-3"
|
class="mt-6 space-y-3"
|
||||||
x-data={
|
x-data={
|
||||||
Jason.encode!(%{
|
Jason.encode!(%{
|
||||||
|
|
@ -211,7 +211,7 @@ defmodule PlausibleWeb.Live.GoalSettings.Form do
|
||||||
submit_name={@f[:currency].name}
|
submit_name={@f[:currency].name}
|
||||||
module={ComboBox}
|
module={ComboBox}
|
||||||
suggest_fun={
|
suggest_fun={
|
||||||
on_full_build do
|
on_ee do
|
||||||
fn
|
fn
|
||||||
"", [] ->
|
"", [] ->
|
||||||
Plausible.Goal.Revenue.currency_options()
|
Plausible.Goal.Revenue.currency_options()
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ defmodule PlausibleWeb.Live.RegisterForm do
|
||||||
~H"""
|
~H"""
|
||||||
<div class="mx-auto mt-6 text-center dark:text-gray-300">
|
<div class="mx-auto mt-6 text-center dark:text-gray-300">
|
||||||
<h1 class="text-3xl font-black">
|
<h1 class="text-3xl font-black">
|
||||||
<%= if small_build?() or @live_action == :register_from_invitation_form do %>
|
<%= if ce?() or @live_action == :register_from_invitation_form do %>
|
||||||
Register your Plausible Analytics account
|
Register your Plausible Analytics account
|
||||||
<% else %>
|
<% else %>
|
||||||
Register your 30-day free trial
|
Register your 30-day free trial
|
||||||
|
|
@ -158,7 +158,7 @@ defmodule PlausibleWeb.Live.RegisterForm do
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% submit_text =
|
<% submit_text =
|
||||||
if small_build?() or @invitation do
|
if ce?() or @invitation do
|
||||||
"Create my account →"
|
"Create my account →"
|
||||||
else
|
else
|
||||||
"Start my free trial →"
|
"Start my free trial →"
|
||||||
|
|
@ -301,7 +301,7 @@ defmodule PlausibleWeb.Live.RegisterForm do
|
||||||
defp add_user(socket, user) do
|
defp add_user(socket, user) do
|
||||||
case Repo.insert(user) do
|
case Repo.insert(user) do
|
||||||
{:ok, _user} ->
|
{:ok, _user} ->
|
||||||
on_full_build do
|
on_ee do
|
||||||
metrics_params =
|
metrics_params =
|
||||||
if socket.assigns.invitation do
|
if socket.assigns.invitation do
|
||||||
%{
|
%{
|
||||||
|
|
|
||||||
|
|
@ -682,7 +682,7 @@ defmodule PlausibleWeb.Live.Sites do
|
||||||
defp check_limits(invitation, _), do: %{invitation: invitation}
|
defp check_limits(invitation, _), do: %{invitation: invitation}
|
||||||
|
|
||||||
defp check_features(%{role: :owner, site: site} = invitation, user) do
|
defp check_features(%{role: :owner, site: site} = invitation, user) do
|
||||||
case Invitations.check_feature_access(site, user, small_build?()) do
|
case Invitations.check_feature_access(site, user, ce?()) do
|
||||||
:ok ->
|
:ok ->
|
||||||
%{invitation: invitation}
|
%{invitation: invitation}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ defmodule PlausibleWeb.Router do
|
||||||
plug :fetch_live_flash
|
plug :fetch_live_flash
|
||||||
plug :put_secure_browser_headers
|
plug :put_secure_browser_headers
|
||||||
plug PlausibleWeb.Plugs.NoRobots
|
plug PlausibleWeb.Plugs.NoRobots
|
||||||
on_full_build(do: nil, else: plug(PlausibleWeb.FirstLaunchPlug, redirect_to: "/register"))
|
on_ee(do: nil, else: plug(PlausibleWeb.FirstLaunchPlug, redirect_to: "/register"))
|
||||||
plug PlausibleWeb.SessionTimeoutPlug, timeout_after_seconds: @two_weeks_in_seconds
|
plug PlausibleWeb.SessionTimeoutPlug, timeout_after_seconds: @two_weeks_in_seconds
|
||||||
plug PlausibleWeb.AuthPlug
|
plug PlausibleWeb.AuthPlug
|
||||||
plug PlausibleWeb.LastSeenPlug
|
plug PlausibleWeb.LastSeenPlug
|
||||||
|
|
@ -51,7 +51,7 @@ defmodule PlausibleWeb.Router do
|
||||||
plug :accepts, ["json"]
|
plug :accepts, ["json"]
|
||||||
end
|
end
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
pipeline :flags do
|
pipeline :flags do
|
||||||
plug :accepts, ["html"]
|
plug :accepts, ["html"]
|
||||||
plug :put_secure_browser_headers
|
plug :put_secure_browser_headers
|
||||||
|
|
@ -62,24 +62,24 @@ defmodule PlausibleWeb.Router do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if Mix.env() in [:dev, :small_dev] do
|
if Mix.env() in [:dev, :ce_dev] do
|
||||||
forward "/sent-emails", Bamboo.SentEmailViewerPlug
|
forward "/sent-emails", Bamboo.SentEmailViewerPlug
|
||||||
end
|
end
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
use Kaffy.Routes,
|
use Kaffy.Routes,
|
||||||
scope: "/crm",
|
scope: "/crm",
|
||||||
pipe_through: [PlausibleWeb.Plugs.NoRobots, PlausibleWeb.CRMAuthPlug]
|
pipe_through: [PlausibleWeb.Plugs.NoRobots, PlausibleWeb.CRMAuthPlug]
|
||||||
end
|
end
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
scope "/crm", PlausibleWeb do
|
scope "/crm", PlausibleWeb do
|
||||||
pipe_through :flags
|
pipe_through :flags
|
||||||
get "/auth/user/:user_id/usage", AdminController, :usage
|
get "/auth/user/:user_id/usage", AdminController, :usage
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
scope path: "/flags" do
|
scope path: "/flags" do
|
||||||
pipe_through :flags
|
pipe_through :flags
|
||||||
forward "/", FunWithFlags.UI.Router, namespace: "flags"
|
forward "/", FunWithFlags.UI.Router, namespace: "flags"
|
||||||
|
|
@ -129,7 +129,7 @@ defmodule PlausibleWeb.Router do
|
||||||
scope "/api/stats", PlausibleWeb.Api do
|
scope "/api/stats", PlausibleWeb.Api do
|
||||||
pipe_through :internal_stats_api
|
pipe_through :internal_stats_api
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
get "/:domain/funnels/:id", StatsController, :funnel
|
get "/:domain/funnels/:id", StatsController, :funnel
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -168,7 +168,7 @@ defmodule PlausibleWeb.Router do
|
||||||
get "/timeseries", ExternalStatsController, :timeseries
|
get "/timeseries", ExternalStatsController, :timeseries
|
||||||
end
|
end
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
scope "/api/v1/sites", PlausibleWeb.Api do
|
scope "/api/v1/sites", PlausibleWeb.Api do
|
||||||
pipe_through [:public_api, PlausibleWeb.AuthorizeSitesApiPlug]
|
pipe_through [:public_api, PlausibleWeb.AuthorizeSitesApiPlug]
|
||||||
|
|
||||||
|
|
@ -352,7 +352,7 @@ defmodule PlausibleWeb.Router do
|
||||||
get "/:website/settings/goals", SiteController, :settings_goals
|
get "/:website/settings/goals", SiteController, :settings_goals
|
||||||
get "/:website/settings/properties", SiteController, :settings_props
|
get "/:website/settings/properties", SiteController, :settings_props
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
get "/:website/settings/funnels", SiteController, :settings_funnels
|
get "/:website/settings/funnels", SiteController, :settings_funnels
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -391,7 +391,7 @@ defmodule PlausibleWeb.Router do
|
||||||
delete "/:website/settings/forget-imported", SiteController, :forget_imported
|
delete "/:website/settings/forget-imported", SiteController, :forget_imported
|
||||||
delete "/:website/settings/forget-import/:import_id", SiteController, :forget_import
|
delete "/:website/settings/forget-import/:import_id", SiteController, :forget_import
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
# exported archives are downloaded from object storage
|
# exported archives are downloaded from object storage
|
||||||
else
|
else
|
||||||
get "/:website/exported-archive", SiteController, :download_local_export
|
get "/:website/exported-archive", SiteController, :download_local_export
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@
|
||||||
method: :post
|
method: :post
|
||||||
) %> to <%= @conn.assigns[:current_user].email %>
|
) %> to <%= @conn.assigns[:current_user].email %>
|
||||||
</li>
|
</li>
|
||||||
<%= if full_build?() do %>
|
<%= if ee?() do %>
|
||||||
<li>
|
<li>
|
||||||
<a class="underline text-indigo-600" href="https://plausible.io/contact">
|
<a class="underline text-indigo-600" href="https://plausible.io/contact">
|
||||||
Contact us
|
Contact us
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,13 @@
|
||||||
You might have used an email address that's not registered in our database. Please verify the email address associated with your Plausible account and attempt the password reset once more.
|
You might have used an email address that's not registered in our database. Please verify the email address associated with your Plausible account and attempt the password reset once more.
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-2 text-sm text-gray-600 dark:text-gray-400 leading-tight">
|
<div class="mt-2 text-sm text-gray-600 dark:text-gray-400 leading-tight">
|
||||||
<span :if={small_build?()}>
|
<span :if={ce?()}>
|
||||||
Certain that you're using the correct email address but still aren't receiving the password reset email? Please check your spam folder or ask on our <a
|
Certain that you're using the correct email address but still aren't receiving the password reset email? Please check your spam folder or ask on our <a
|
||||||
href="https://github.com/plausible/analytics/discussions"
|
href="https://github.com/plausible/analytics/discussions"
|
||||||
class="text-indigo-500"
|
class="text-indigo-500"
|
||||||
>community-supported forum</a>.
|
>community-supported forum</a>.
|
||||||
</span>
|
</span>
|
||||||
<span :if={full_build?()}>
|
<span :if={ee?()}>
|
||||||
Certain that you're using the correct email address but still aren't receiving the password reset email? Please check your spam folder or <a
|
Certain that you're using the correct email address but still aren't receiving the password reset email? Please check your spam folder or <a
|
||||||
href="https://plausible.io/contact"
|
href="https://plausible.io/contact"
|
||||||
class="text-indigo-500"
|
class="text-indigo-500"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<div x-data="{disable2FAOpen: false, regenerate2FAOpen: false}">
|
<div x-data="{disable2FAOpen: false, regenerate2FAOpen: false}">
|
||||||
<%= if full_build?() do %>
|
<%= if ee?() do %>
|
||||||
<div class="max-w-2xl px-8 pt-4 pb-8 mx-auto mt-24 bg-white border-t-2 border-orange-200 rounded rounded-t-none shadow-md dark:bg-gray-800 dark:border-orange-200 ">
|
<div class="max-w-2xl px-8 pt-4 pb-8 mx-auto mt-24 bg-white border-t-2 border-orange-200 rounded rounded-t-none shadow-md dark:bg-gray-800 dark:border-orange-200 ">
|
||||||
<div class="flex flex-wrap justify-between">
|
<div class="flex flex-wrap justify-between">
|
||||||
<h2 class="text-xl font-black dark:text-gray-100 w-max mr-4 mt-2">Subscription Plan</h2>
|
<h2 class="text-xl font-black dark:text-gray-100 w-max mr-4 mt-2">Subscription Plan</h2>
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
>
|
>
|
||||||
Use recovery code
|
Use recovery code
|
||||||
</a>
|
</a>
|
||||||
<%= if full_build?() do %>
|
<%= if ee?() do %>
|
||||||
<br /> Lost your recovery codes?
|
<br /> Lost your recovery codes?
|
||||||
<a href="https://plausible.io/contact" class="underline text-indigo-600">
|
<a href="https://plausible.io/contact" class="underline text-indigo-600">
|
||||||
Contact us
|
Contact us
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@
|
||||||
<a href={Routes.auth_path(@conn, :verify_2fa)} class="underline text-indigo-600">
|
<a href={Routes.auth_path(@conn, :verify_2fa)} class="underline text-indigo-600">
|
||||||
Enter verification code
|
Enter verification code
|
||||||
</a>
|
</a>
|
||||||
<%= if full_build?() do %>
|
<%= if ee?() do %>
|
||||||
<br /> Lost your recovery codes?
|
<br /> Lost your recovery codes?
|
||||||
<a href="https://plausible.io/contact" class="underline text-indigo-600">
|
<a href="https://plausible.io/contact" class="underline text-indigo-600">
|
||||||
Contact us
|
Contact us
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
<% else %>
|
<% else %>
|
||||||
Unfortunately, your CSV import for <%= @site_import.site.domain %> did not complete successfully. Sorry about that!
|
Unfortunately, your CSV import for <%= @site_import.site.domain %> did not complete successfully. Sorry about that!
|
||||||
<br /><br /> Please try to do the import once again.
|
<br /><br /> Please try to do the import once again.
|
||||||
<%= if full_build?() do %>
|
<%= if ee?() do %>
|
||||||
<br /> <br />
|
<br /> <br />
|
||||||
Please reply to this email to let us know if you're still experiencing issues with the import.
|
Please reply to this email to let us know if you're still experiencing issues with the import.
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
Your <%= if full_build?() do %>Plausible Analytics <% end %>export for <%= @site.domain %> has encountered an error and was unsuccessful.
|
Your <%= if ee?() do %>Plausible Analytics <% end %>export for <%= @site.domain %> has encountered an error and was unsuccessful.
|
||||||
Sorry for the trouble this may have caused.
|
Sorry for the trouble this may have caused.
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
Please attempt to export your data again.
|
Please attempt to export your data again.
|
||||||
<%= if full_build?() do %>Should the problem persist, do reply to this email so we can assist. Thanks!<% end %>
|
<%= if ee?() do %>Should the problem persist, do reply to this email so we can assist. Thanks!<% end %>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
Your <%= if full_build?() do %>Plausible Analytics <% end %>export for <%= @site.domain %> is now ready for download.
|
Your <%= if ee?() do %>Plausible Analytics <% end %>export for <%= @site.domain %> is now ready for download.
|
||||||
Please click <a href="<%= @download_url %>">here</a> to start the download process.
|
Please click <a href="<%= @download_url %>">here</a> to start the download process.
|
||||||
<%= if @expires_in do %>Note that this link will expire <%= @expires_in %>.<% end %>
|
<%= if @expires_in do %>Note that this link will expire <%= @expires_in %>.<% end %>
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
Unfortunately, your Google Analytics import for <%= @site_import.site.domain %> did not complete successfully. Sorry about that!
|
Unfortunately, your Google Analytics import for <%= @site_import.site.domain %> did not complete successfully. Sorry about that!
|
||||||
<br /><br />
|
<br /><br />
|
||||||
Please try to do the import once again. Sometimes the Google Analytics API just randomly returns empty data. It's intermittent and random. Trying to do the import again may return what you need.
|
Please try to do the import once again. Sometimes the Google Analytics API just randomly returns empty data. It's intermittent and random. Trying to do the import again may return what you need.
|
||||||
<%= if full_build?() do %>
|
<%= if ee?() do %>
|
||||||
<br /> <br />
|
<br /> <br />
|
||||||
Please reply to this email to let us know if you're still experiencing issues with the import.
|
Please reply to this email to let us know if you're still experiencing issues with the import.
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
||||||
|
|
@ -22,14 +22,14 @@
|
||||||
<div class="ml-3">
|
<div class="ml-3">
|
||||||
<h3 class="text-sm font-medium text-yellow-800 dark:text-yellow-400">
|
<h3 class="text-sm font-medium text-yellow-800 dark:text-yellow-400">
|
||||||
There has been a server error.
|
There has been a server error.
|
||||||
<%= if full_build?() do %>
|
<%= if ee?() do %>
|
||||||
But don't worry, we're on it!
|
But don't worry, we're on it!
|
||||||
<% end %>
|
<% end %>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<div class="mt-2 text-sm text-yellow-700 dark:text-yellow-300">
|
<div class="mt-2 text-sm text-yellow-700 dark:text-yellow-300">
|
||||||
<p>
|
<p>
|
||||||
<%= if assigns[:trace_id] && full_build?() do %>
|
<%= if assigns[:trace_id] && ee?() do %>
|
||||||
If you would like to help, tell us what you were trying to do. Our development team will receive your report.
|
If you would like to help, tell us what you were trying to do. Our development team will receive your report.
|
||||||
<% else %>
|
<% else %>
|
||||||
We have been notified.
|
We have been notified.
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= if full_build?() do %>
|
<%= if ee?() do %>
|
||||||
<%= if assigns[:trace_id] do %>
|
<%= if assigns[:trace_id] do %>
|
||||||
<div class="my-6">
|
<div class="my-6">
|
||||||
<%= form_for :error, Routes.error_report_path(PlausibleWeb.Endpoint, :submit_error_report), fn f -> %>
|
<%= form_for :error, Routes.error_report_path(PlausibleWeb.Endpoint, :submit_error_report), fn f -> %>
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,12 @@
|
||||||
) %>
|
) %>
|
||||||
</h4>
|
</h4>
|
||||||
<p class="mt-4 text-base text-gray-400 leading-6">
|
<p class="mt-4 text-base text-gray-400 leading-6">
|
||||||
<%= if full_build?() do %>
|
<%= if ee?() do %>
|
||||||
Made and hosted in the EU <span class="text-lg">🇪🇺</span> <br />
|
Made and hosted in the EU <span class="text-lg">🇪🇺</span> <br />
|
||||||
Solely funded by our subscribers.
|
Solely funded by our subscribers.
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= if small_build?() do %>
|
<%= if ce?() do %>
|
||||||
This dashboard is running on self-managed infrastructure, not tested by Plausible Analytics. We cannot vouch for its performance or reliability. For official managed hosting, check out
|
This dashboard is running on self-managed infrastructure, not tested by Plausible Analytics. We cannot vouch for its performance or reliability. For official managed hosting, check out
|
||||||
<.styled_link href="https://plausible.io">
|
<.styled_link href="https://plausible.io">
|
||||||
plausible.io
|
plausible.io
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
<% @conn.assigns[:current_user] -> %>
|
<% @conn.assigns[:current_user] -> %>
|
||||||
<ul class="flex items-center w-full sm:w-auto">
|
<ul class="flex items-center w-full sm:w-auto">
|
||||||
<li
|
<li
|
||||||
:if={full_build?() and Plausible.Users.on_trial?(@conn.assigns[:current_user])}
|
:if={ee?() and Plausible.Users.on_trial?(@conn.assigns[:current_user])}
|
||||||
class="hidden mr-6 sm:block"
|
class="hidden mr-6 sm:block"
|
||||||
>
|
>
|
||||||
<%= link(trial_notificaton(@conn.assigns[:current_user]),
|
<%= link(trial_notificaton(@conn.assigns[:current_user]),
|
||||||
|
|
@ -61,7 +61,7 @@
|
||||||
<.dropdown_link new_tab href="https://plausible.io/docs">
|
<.dropdown_link new_tab href="https://plausible.io/docs">
|
||||||
Help Center
|
Help Center
|
||||||
</.dropdown_link>
|
</.dropdown_link>
|
||||||
<%= if full_build?() do %>
|
<%= if ee?() do %>
|
||||||
<.dropdown_link new_tab href="https://plausible.io/contact">
|
<.dropdown_link new_tab href="https://plausible.io/contact">
|
||||||
Contact Support
|
Contact Support
|
||||||
</.dropdown_link>
|
</.dropdown_link>
|
||||||
|
|
@ -80,7 +80,7 @@
|
||||||
</:panel>
|
</:panel>
|
||||||
</.dropdown>
|
</.dropdown>
|
||||||
</li>
|
</li>
|
||||||
<%= if @conn.assigns[:current_user] && full_build?() do %>
|
<%= if @conn.assigns[:current_user] && ee?() do %>
|
||||||
<li id="changelog-notification" class="relative py-2"></li>
|
<li id="changelog-notification" class="relative py-2"></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<%= on_full_build do %>
|
<%= on_ee do %>
|
||||||
<%= if !@conn.assigns[:skip_plausible_tracking] do %>
|
<%= if !@conn.assigns[:skip_plausible_tracking] do %>
|
||||||
<script
|
<script
|
||||||
defer
|
defer
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<%= @inner_content %>
|
<%= @inner_content %>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
|
|
||||||
<%= if full_build?() do %>Regards,<br />
|
<%= if ee?() do %>Regards,<br />
|
||||||
The Plausible Team 💌
|
The Plausible Team 💌
|
||||||
<br /><br /><% end %>
|
<br /><br /><% end %>
|
||||||
|
|
||||||
|
|
@ -12,4 +12,4 @@ The Plausible Team 💌
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<%= link(plausible_url(), to: plausible_url()) %><br />
|
<%= link(plausible_url(), to: plausible_url()) %><br />
|
||||||
|
|
||||||
<%= if full_build?() do %>{{{ pm:unsubscribe }}}<% end %>
|
<%= if ee?() do %>{{{ pm:unsubscribe }}}<% end %>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<%= @inner_content %>
|
<%= @inner_content %>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
|
|
||||||
<%= if full_build?() do %>Regards,<br />
|
<%= if ee?() do %>Regards,<br />
|
||||||
The Plausible Team 💌
|
The Plausible Team 💌
|
||||||
<br /><br /><% end %>
|
<br /><br /><% end %>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
session: %{
|
session: %{
|
||||||
"site_id" => @site.id,
|
"site_id" => @site.id,
|
||||||
"current_user_id" => @current_user.id,
|
"current_user_id" => @current_user.id,
|
||||||
"storage" => on_full_build(do: "s3", else: "local")
|
"storage" => on_ee(do: "s3", else: "local")
|
||||||
}
|
}
|
||||||
) %>
|
) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<p class="mt-2 text-sm leading-5 text-gray-500 dark:text-gray-200">
|
<p class="mt-2 text-sm leading-5 text-gray-500 dark:text-gray-200">
|
||||||
Define actions that you want your users to take, like visiting a certain page, submitting a form, etc.
|
Define actions that you want your users to take, like visiting a certain page, submitting a form, etc.
|
||||||
</p>
|
</p>
|
||||||
<p :if={full_build?()} class="text-sm leading-5 text-gray-500 dark:text-gray-200">
|
<p :if={ee?()} class="text-sm leading-5 text-gray-500 dark:text-gray-200">
|
||||||
You can also <a
|
You can also <a
|
||||||
href={Routes.site_path(@conn, :settings_funnels, @site.domain)}
|
href={Routes.site_path(@conn, :settings_funnels, @site.domain)}
|
||||||
class="text-indigo-500 underline"
|
class="text-indigo-500 underline"
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
session: %{
|
session: %{
|
||||||
"site_id" => @site.id,
|
"site_id" => @site.id,
|
||||||
"email_to" => @current_user.email,
|
"email_to" => @current_user.email,
|
||||||
"storage" => on_full_build(do: "s3", else: "local")
|
"storage" => on_ee(do: "s3", else: "local")
|
||||||
}
|
}
|
||||||
) %>
|
) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -42,14 +42,14 @@
|
||||||
</.styled_link>
|
</.styled_link>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
<span :if={full_build?()}>
|
<span :if={ee?()}>
|
||||||
Check the
|
Check the
|
||||||
<.styled_link href={Routes.site_path(@conn, :settings_general, @site.domain)}>
|
<.styled_link href={Routes.site_path(@conn, :settings_general, @site.domain)}>
|
||||||
site settings
|
site settings
|
||||||
</.styled_link>
|
</.styled_link>
|
||||||
to invite team members, <br /> import historical stats and more.
|
to invite team members, <br /> import historical stats and more.
|
||||||
</span>
|
</span>
|
||||||
<span :if={small_build?()}>
|
<span :if={ce?()}>
|
||||||
Still not working? Ask on our
|
Still not working? Ask on our
|
||||||
<.styled_link new_tab href="https://github.com/plausible/analytics/discussions">
|
<.styled_link new_tab href="https://github.com/plausible/analytics/discussions">
|
||||||
community-supported forum
|
community-supported forum
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ defmodule PlausibleWeb.ErrorView do
|
||||||
|
|
||||||
def render("500.json", %{conn: %{assigns: %{plugins_api: true}}}) do
|
def render("500.json", %{conn: %{assigns: %{plugins_api: true}}}) do
|
||||||
contact_support_note =
|
contact_support_note =
|
||||||
on_full_build do
|
on_ee do
|
||||||
"If the problem persists please contact support@plausible.io"
|
"If the problem persists please contact support@plausible.io"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ defmodule PlausibleWeb.LayoutView do
|
||||||
end
|
end
|
||||||
|
|
||||||
def logo_path(filename) do
|
def logo_path(filename) do
|
||||||
if full_build?() do
|
if ee?() do
|
||||||
Path.join("/images/ee/", filename)
|
Path.join("/images/ee/", filename)
|
||||||
else
|
else
|
||||||
Path.join("/images/ce/", filename)
|
Path.join("/images/ce/", filename)
|
||||||
|
|
@ -61,7 +61,7 @@ defmodule PlausibleWeb.LayoutView do
|
||||||
%{key: "People", value: "people", icon: :users},
|
%{key: "People", value: "people", icon: :users},
|
||||||
%{key: "Visibility", value: "visibility", icon: :eye},
|
%{key: "Visibility", value: "visibility", icon: :eye},
|
||||||
%{key: "Goals", value: "goals", icon: :check_circle},
|
%{key: "Goals", value: "goals", icon: :check_circle},
|
||||||
on_full_build do
|
on_ee do
|
||||||
%{key: "Funnels", value: "funnels", icon: :funnel}
|
%{key: "Funnels", value: "funnels", icon: :funnel}
|
||||||
end,
|
end,
|
||||||
%{key: "Custom Properties", value: "properties", icon: :document_text},
|
%{key: "Custom Properties", value: "properties", icon: :document_text},
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ defmodule Plausible.Workers.ClickhouseCleanSites do
|
||||||
"imported_visitors"
|
"imported_visitors"
|
||||||
]
|
]
|
||||||
|
|
||||||
@settings if Mix.env() in [:test, :small_test], do: [mutations_sync: 2], else: []
|
@settings if Mix.env() in [:test, :ce_test], do: [mutations_sync: 2], else: []
|
||||||
|
|
||||||
def perform(_job) do
|
def perform(_job) do
|
||||||
deleted_sites = get_deleted_sites_with_clickhouse_data()
|
deleted_sites = get_deleted_sites_with_clickhouse_data()
|
||||||
|
|
|
||||||
22
mix.exs
22
mix.exs
|
|
@ -10,7 +10,7 @@ defmodule Plausible.MixProject do
|
||||||
version: System.get_env("APP_VERSION", "0.0.1"),
|
version: System.get_env("APP_VERSION", "0.0.1"),
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
elixirc_paths: elixirc_paths(Mix.env()),
|
elixirc_paths: elixirc_paths(Mix.env()),
|
||||||
start_permanent: Mix.env() in [:prod, :small],
|
start_permanent: Mix.env() in [:prod, :ce],
|
||||||
aliases: aliases(),
|
aliases: aliases(),
|
||||||
deps: deps(),
|
deps: deps(),
|
||||||
test_coverage: [
|
test_coverage: [
|
||||||
|
|
@ -51,10 +51,10 @@ defmodule Plausible.MixProject do
|
||||||
defp elixirc_paths(env) when env in [:test, :dev],
|
defp elixirc_paths(env) when env in [:test, :dev],
|
||||||
do: ["lib", "test/support", "extra/lib"]
|
do: ["lib", "test/support", "extra/lib"]
|
||||||
|
|
||||||
defp elixirc_paths(env) when env in [:small_test, :small_dev],
|
defp elixirc_paths(env) when env in [:ce_test, :ce_dev],
|
||||||
do: ["lib", "test/support"]
|
do: ["lib", "test/support"]
|
||||||
|
|
||||||
defp elixirc_paths(:small), do: ["lib"]
|
defp elixirc_paths(:ce), do: ["lib"]
|
||||||
defp elixirc_paths(_), do: ["lib", "extra/lib"]
|
defp elixirc_paths(_), do: ["lib", "extra/lib"]
|
||||||
|
|
||||||
# Specifies your project dependencies.
|
# Specifies your project dependencies.
|
||||||
|
|
@ -68,7 +68,7 @@ defmodule Plausible.MixProject do
|
||||||
{:bamboo_smtp, "~> 4.1"},
|
{:bamboo_smtp, "~> 4.1"},
|
||||||
{:bamboo_mua, "~> 0.1.4"},
|
{:bamboo_mua, "~> 0.1.4"},
|
||||||
{:bcrypt_elixir, "~> 3.0"},
|
{:bcrypt_elixir, "~> 3.0"},
|
||||||
{:bypass, "~> 2.1", only: [:dev, :test, :small_test]},
|
{:bypass, "~> 2.1", only: [:dev, :test, :ce_test]},
|
||||||
{:ecto_ch, "~> 0.3"},
|
{:ecto_ch, "~> 0.3"},
|
||||||
{:cloak, "~> 1.1"},
|
{:cloak, "~> 1.1"},
|
||||||
{:cloak_ecto, "~> 1.2"},
|
{:cloak_ecto, "~> 1.2"},
|
||||||
|
|
@ -77,15 +77,15 @@ defmodule Plausible.MixProject do
|
||||||
{:credo, "~> 1.5", only: [:dev, :test], runtime: false},
|
{:credo, "~> 1.5", only: [:dev, :test], runtime: false},
|
||||||
{:csv, "~> 2.3"},
|
{:csv, "~> 2.3"},
|
||||||
{:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false},
|
{:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false},
|
||||||
{:double, "~> 0.8.0", only: [:test, :small_test]},
|
{:double, "~> 0.8.0", only: [:test, :ce_test]},
|
||||||
{:ecto, "~> 3.11.0"},
|
{:ecto, "~> 3.11.0"},
|
||||||
{:ecto_sql, "~> 3.11.0"},
|
{:ecto_sql, "~> 3.11.0"},
|
||||||
{:envy, "~> 1.1.1"},
|
{:envy, "~> 1.1.1"},
|
||||||
{:eqrcode, "~> 0.1.10"},
|
{:eqrcode, "~> 0.1.10"},
|
||||||
{:ex_machina, "~> 2.3", only: [:dev, :test, :small_dev, :small_test]},
|
{:ex_machina, "~> 2.3", only: [:dev, :test, :ce_dev, :ce_test]},
|
||||||
{:excoveralls, "~> 0.10", only: :test},
|
{:excoveralls, "~> 0.10", only: :test},
|
||||||
{:finch, "~> 0.16.0"},
|
{:finch, "~> 0.16.0"},
|
||||||
{:floki, "~> 0.35.0", only: [:dev, :test, :small_dev, :small_test]},
|
{:floki, "~> 0.35.0", only: [:dev, :test, :ce_dev, :ce_test]},
|
||||||
{:fun_with_flags, "~> 1.11.0"},
|
{:fun_with_flags, "~> 1.11.0"},
|
||||||
{:fun_with_flags_ui, "~> 1.0"},
|
{:fun_with_flags_ui, "~> 1.0"},
|
||||||
{:locus, "~> 2.3"},
|
{:locus, "~> 2.3"},
|
||||||
|
|
@ -94,7 +94,7 @@ defmodule Plausible.MixProject do
|
||||||
{:jason, "~> 1.3"},
|
{:jason, "~> 1.3"},
|
||||||
{:kaffy, "~> 0.10.2", only: [:dev, :test, :staging, :prod]},
|
{:kaffy, "~> 0.10.2", only: [:dev, :test, :staging, :prod]},
|
||||||
{:location, git: "https://github.com/plausible/location.git"},
|
{:location, git: "https://github.com/plausible/location.git"},
|
||||||
{:mox, "~> 1.0", only: [:test, :small_test]},
|
{:mox, "~> 1.0", only: [:test, :ce_test]},
|
||||||
{:nanoid, "~> 2.1.0"},
|
{:nanoid, "~> 2.1.0"},
|
||||||
{:nimble_totp, "~> 1.0"},
|
{:nimble_totp, "~> 1.0"},
|
||||||
{:oban, "~> 2.17.0"},
|
{:oban, "~> 2.17.0"},
|
||||||
|
|
@ -109,7 +109,7 @@ defmodule Plausible.MixProject do
|
||||||
{:phoenix_view, "~> 2.0"},
|
{:phoenix_view, "~> 2.0"},
|
||||||
{:phoenix_ecto, "~> 4.0"},
|
{:phoenix_ecto, "~> 4.0"},
|
||||||
{:phoenix_html, "~> 3.3", override: true},
|
{:phoenix_html, "~> 3.3", override: true},
|
||||||
{:phoenix_live_reload, "~> 1.2", only: [:dev, :small_dev]},
|
{:phoenix_live_reload, "~> 1.2", only: [:dev, :ce_dev]},
|
||||||
{:phoenix_pubsub, "~> 2.0"},
|
{:phoenix_pubsub, "~> 2.0"},
|
||||||
{:phoenix_live_view, "~> 0.18"},
|
{:phoenix_live_view, "~> 0.18"},
|
||||||
{:php_serializer, "~> 2.0"},
|
{:php_serializer, "~> 2.0"},
|
||||||
|
|
@ -134,8 +134,8 @@ defmodule Plausible.MixProject do
|
||||||
{:joken, "~> 2.5"},
|
{:joken, "~> 2.5"},
|
||||||
{:paginator, git: "https://github.com/duffelhq/paginator.git"},
|
{:paginator, git: "https://github.com/duffelhq/paginator.git"},
|
||||||
{:scrivener_ecto, "~> 2.0"},
|
{:scrivener_ecto, "~> 2.0"},
|
||||||
{:esbuild, "~> 0.7", runtime: Mix.env() in [:dev, :small_dev]},
|
{:esbuild, "~> 0.7", runtime: Mix.env() in [:dev, :ce_dev]},
|
||||||
{:tailwind, "~> 0.2.0", runtime: Mix.env() in [:dev, :small_dev]},
|
{:tailwind, "~> 0.2.0", runtime: Mix.env() in [:dev, :ce_dev]},
|
||||||
{:ex_json_logger, "~> 1.4.0"},
|
{:ex_json_logger, "~> 1.4.0"},
|
||||||
{:ecto_network, "~> 1.5.0"},
|
{:ecto_network, "~> 1.5.0"},
|
||||||
{:ex_aws, "~> 2.5"},
|
{:ex_aws, "~> 2.5"},
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ defmodule Plausible.UsersTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "on_trial?" do
|
describe "on_trial?" do
|
||||||
@describetag :full_build_only
|
@describetag :ee_only
|
||||||
test "is true with >= 0 trial days left" do
|
test "is true with >= 0 trial days left" do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@ defmodule Plausible.UsersTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "update_accept_traffic_until" do
|
describe "update_accept_traffic_until" do
|
||||||
@describetag :full_build_only
|
@describetag :ee_only
|
||||||
test "update" do
|
test "update" do
|
||||||
user = insert(:user) |> User.start_trial() |> Repo.update!()
|
user = insert(:user) |> User.start_trial() |> Repo.update!()
|
||||||
# 30 for trial + 14
|
# 30 for trial + 14
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ defmodule Plausible.BillingTest do
|
||||||
refute Repo.reload!(site).locked
|
refute Repo.reload!(site).locked
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "updates accept_traffic_until" do
|
test "updates accept_traffic_until" do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
|
|
@ -228,7 +228,7 @@ defmodule Plausible.BillingTest do
|
||||||
refute Repo.reload!(site).locked
|
refute Repo.reload!(site).locked
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "updates accept_traffic_until" do
|
test "updates accept_traffic_until" do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
subscription = insert(:subscription, user: user)
|
subscription = insert(:subscription, user: user)
|
||||||
|
|
@ -359,7 +359,7 @@ defmodule Plausible.BillingTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "subscription_payment_succeeded" do
|
describe "subscription_payment_succeeded" do
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "updates accept_traffic_until" do
|
test "updates accept_traffic_until" do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
subscription = insert(:subscription, user: user)
|
subscription = insert(:subscription, user: user)
|
||||||
|
|
|
||||||
|
|
@ -307,7 +307,7 @@ defmodule Plausible.Billing.PlansTest do
|
||||||
assert Plans.suggest_tier(user) == :growth
|
assert Plans.suggest_tier(user) == :growth
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "suggests Business tier for a user who used the Revenue Goals, even when they signed up before Business tier release" do
|
test "suggests Business tier for a user who used the Revenue Goals, even when they signed up before Business tier release" do
|
||||||
user = insert(:user, inserted_at: ~N[2023-10-25 10:00:00])
|
user = insert(:user, inserted_at: ~N[2023-10-25 10:00:00])
|
||||||
site = insert(:site, members: [user])
|
site = insert(:site, members: [user])
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ defmodule Plausible.Billing.QuotaTest do
|
||||||
alias Plausible.Billing.{Quota, Plans}
|
alias Plausible.Billing.{Quota, Plans}
|
||||||
alias Plausible.Billing.Feature.{Goals, Props, StatsAPI}
|
alias Plausible.Billing.Feature.{Goals, Props, StatsAPI}
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
alias Plausible.Billing.Feature.Funnels
|
alias Plausible.Billing.Feature.Funnels
|
||||||
alias Plausible.Billing.Feature.RevenueGoals
|
alias Plausible.Billing.Feature.RevenueGoals
|
||||||
end
|
end
|
||||||
|
|
@ -17,7 +17,7 @@ defmodule Plausible.Billing.QuotaTest do
|
||||||
@v4_1m_plan_id "857101"
|
@v4_1m_plan_id "857101"
|
||||||
|
|
||||||
describe "site_limit/1" do
|
describe "site_limit/1" do
|
||||||
@describetag :full_build_only
|
@describetag :ee_only
|
||||||
|
|
||||||
test "returns 50 when user is on an old plan" do
|
test "returns 50 when user is on an old plan" do
|
||||||
user_on_v1 = insert(:user, subscription: build(:subscription, paddle_plan_id: @v1_plan_id))
|
user_on_v1 = insert(:user, subscription: build(:subscription, paddle_plan_id: @v1_plan_id))
|
||||||
|
|
@ -386,7 +386,7 @@ defmodule Plausible.Billing.QuotaTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "team_member_limit/1" do
|
describe "team_member_limit/1" do
|
||||||
@describetag :full_build_only
|
@describetag :ee_only
|
||||||
test "returns unlimited when user is on an old plan" do
|
test "returns unlimited when user is on an old plan" do
|
||||||
user_on_v1 = insert(:user, subscription: build(:subscription, paddle_plan_id: @v1_plan_id))
|
user_on_v1 = insert(:user, subscription: build(:subscription, paddle_plan_id: @v1_plan_id))
|
||||||
user_on_v2 = insert(:user, subscription: build(:subscription, paddle_plan_id: @v2_plan_id))
|
user_on_v2 = insert(:user, subscription: build(:subscription, paddle_plan_id: @v2_plan_id))
|
||||||
|
|
@ -458,7 +458,7 @@ defmodule Plausible.Billing.QuotaTest do
|
||||||
assert [Props] == Quota.features_usage(user)
|
assert [Props] == Quota.features_usage(user)
|
||||||
end
|
end
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
test "returns [Funnels] when user/site uses funnels" do
|
test "returns [Funnels] when user/site uses funnels" do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
site = insert(:site, memberships: [build(:site_membership, user: user, role: :owner)])
|
site = insert(:site, memberships: [build(:site_membership, user: user, role: :owner)])
|
||||||
|
|
@ -488,7 +488,7 @@ defmodule Plausible.Billing.QuotaTest do
|
||||||
assert [StatsAPI] == Quota.features_usage(user)
|
assert [StatsAPI] == Quota.features_usage(user)
|
||||||
end
|
end
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
test "returns multiple features" do
|
test "returns multiple features" do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
|
|
@ -522,7 +522,7 @@ defmodule Plausible.Billing.QuotaTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "allowed_features_for/1" do
|
describe "allowed_features_for/1" do
|
||||||
on_full_build do
|
on_ee do
|
||||||
test "users with expired trials have no access to subscription features" do
|
test "users with expired trials have no access to subscription features" do
|
||||||
user = insert(:user, trial_expiry_date: ~D[2023-01-01])
|
user = insert(:user, trial_expiry_date: ~D[2023-01-01])
|
||||||
assert [Goals] == Quota.allowed_features_for(user)
|
assert [Goals] == Quota.allowed_features_for(user)
|
||||||
|
|
@ -544,7 +544,7 @@ defmodule Plausible.Billing.QuotaTest do
|
||||||
assert [Goals, Props, StatsAPI] == Quota.allowed_features_for(user)
|
assert [Goals, Props, StatsAPI] == Quota.allowed_features_for(user)
|
||||||
end
|
end
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
test "returns the enterprise plan features" do
|
test "returns the enterprise plan features" do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
defmodule Plausible.FunnelsTest do
|
defmodule Plausible.FunnelsTest do
|
||||||
use Plausible.DataCase
|
use Plausible.DataCase
|
||||||
@moduletag :full_build_only
|
@moduletag :ee_only
|
||||||
|
|
||||||
use Plausible
|
use Plausible
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
alias Plausible.Goals
|
alias Plausible.Goals
|
||||||
alias Plausible.Funnels
|
alias Plausible.Funnels
|
||||||
alias Plausible.Stats
|
alias Plausible.Stats
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ defmodule Plausible.GoalsTest do
|
||||||
assert {"has already been taken", _} = changeset.errors[:event_name]
|
assert {"has already been taken", _} = changeset.errors[:event_name]
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "create/2 sets site.updated_at for revenue goal" do
|
test "create/2 sets site.updated_at for revenue goal" do
|
||||||
site_1 = insert(:site, updated_at: DateTime.add(DateTime.utc_now(), -3600))
|
site_1 = insert(:site, updated_at: DateTime.add(DateTime.utc_now(), -3600))
|
||||||
|
|
||||||
|
|
@ -64,7 +64,7 @@ defmodule Plausible.GoalsTest do
|
||||||
:eq
|
:eq
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "create/2 creates revenue goal" do
|
test "create/2 creates revenue goal" do
|
||||||
site = insert(:site)
|
site = insert(:site)
|
||||||
{:ok, goal} = Goals.create(site, %{"event_name" => "Purchase", "currency" => "EUR"})
|
{:ok, goal} = Goals.create(site, %{"event_name" => "Purchase", "currency" => "EUR"})
|
||||||
|
|
@ -73,7 +73,7 @@ defmodule Plausible.GoalsTest do
|
||||||
assert goal.currency == :EUR
|
assert goal.currency == :EUR
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "create/2 returns error when site does not have access to revenue goals" do
|
test "create/2 returns error when site does not have access to revenue goals" do
|
||||||
user = insert(:user, subscription: build(:growth_subscription))
|
user = insert(:user, subscription: build(:growth_subscription))
|
||||||
site = insert(:site, members: [user])
|
site = insert(:site, members: [user])
|
||||||
|
|
@ -82,7 +82,7 @@ defmodule Plausible.GoalsTest do
|
||||||
Goals.create(site, %{"event_name" => "Purchase", "currency" => "EUR"})
|
Goals.create(site, %{"event_name" => "Purchase", "currency" => "EUR"})
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "create/2 fails for unknown currency code" do
|
test "create/2 fails for unknown currency code" do
|
||||||
site = insert(:site)
|
site = insert(:site)
|
||||||
|
|
||||||
|
|
@ -92,7 +92,7 @@ defmodule Plausible.GoalsTest do
|
||||||
assert [currency: {"is invalid", _}] = changeset.errors
|
assert [currency: {"is invalid", _}] = changeset.errors
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "list_revenue_goals/1 lists event_names and currencies for each revenue goal" do
|
test "list_revenue_goals/1 lists event_names and currencies for each revenue goal" do
|
||||||
site = insert(:site)
|
site = insert(:site)
|
||||||
|
|
||||||
|
|
@ -155,7 +155,7 @@ defmodule Plausible.GoalsTest do
|
||||||
assert [] = Goals.for_site(site)
|
assert [] = Goals.for_site(site)
|
||||||
end
|
end
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
test "goals can be fetched with funnel count preloaded" do
|
test "goals can be fetched with funnel count preloaded" do
|
||||||
site = insert(:site)
|
site = insert(:site)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ defmodule Plausible.Imported.CSVImporterTest do
|
||||||
|
|
||||||
doctest CSVImporter, import: true
|
doctest CSVImporter, import: true
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
@moduletag :minio
|
@moduletag :minio
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -33,7 +33,7 @@ defmodule Plausible.Imported.CSVImporterTest do
|
||||||
Enum.map(tables, fn table ->
|
Enum.map(tables, fn table ->
|
||||||
filename = "#{table}_#{start_date}_#{end_date}.csv"
|
filename = "#{table}_#{start_date}_#{end_date}.csv"
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
%{
|
%{
|
||||||
"filename" => filename,
|
"filename" => filename,
|
||||||
"s3_url" =>
|
"s3_url" =>
|
||||||
|
|
@ -54,7 +54,7 @@ defmodule Plausible.Imported.CSVImporterTest do
|
||||||
start_date: date_range.first,
|
start_date: date_range.first,
|
||||||
end_date: date_range.last,
|
end_date: date_range.last,
|
||||||
uploads: uploads,
|
uploads: uploads,
|
||||||
storage: on_full_build(do: "s3", else: "local")
|
storage: on_ee(do: "s3", else: "local")
|
||||||
)
|
)
|
||||||
|
|
||||||
assert %Oban.Job{args: %{"import_id" => import_id, "uploads" => ^uploads} = args} =
|
assert %Oban.Job{args: %{"import_id" => import_id, "uploads" => ^uploads} = args} =
|
||||||
|
|
@ -72,7 +72,7 @@ defmodule Plausible.Imported.CSVImporterTest do
|
||||||
|
|
||||||
assert CSVImporter.parse_args(args) == [
|
assert CSVImporter.parse_args(args) == [
|
||||||
uploads: uploads,
|
uploads: uploads,
|
||||||
storage: on_full_build(do: "s3", else: "local")
|
storage: on_ee(do: "s3", else: "local")
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -312,7 +312,7 @@ defmodule Plausible.Imported.CSVImporterTest do
|
||||||
|
|
||||||
uploads =
|
uploads =
|
||||||
for %{name: name, body: body} <- csvs do
|
for %{name: name, body: body} <- csvs do
|
||||||
on_full_build do
|
on_ee do
|
||||||
%{s3_url: s3_url} = Plausible.S3.import_presign_upload(site.id, name)
|
%{s3_url: s3_url} = Plausible.S3.import_presign_upload(site.id, name)
|
||||||
[bucket, key] = String.split(URI.parse(s3_url).path, "/", parts: 2)
|
[bucket, key] = String.split(URI.parse(s3_url).path, "/", parts: 2)
|
||||||
ExAws.request!(ExAws.S3.put_object(bucket, key, body))
|
ExAws.request!(ExAws.S3.put_object(bucket, key, body))
|
||||||
|
|
@ -331,7 +331,7 @@ defmodule Plausible.Imported.CSVImporterTest do
|
||||||
start_date: date_range.first,
|
start_date: date_range.first,
|
||||||
end_date: date_range.last,
|
end_date: date_range.last,
|
||||||
uploads: uploads,
|
uploads: uploads,
|
||||||
storage: on_full_build(do: "s3", else: "local")
|
storage: on_ee(do: "s3", else: "local")
|
||||||
)
|
)
|
||||||
|
|
||||||
assert %{success: 1} = Oban.drain_queue(queue: :analytics_imports, with_safety?: false)
|
assert %{success: 1} = Oban.drain_queue(queue: :analytics_imports, with_safety?: false)
|
||||||
|
|
@ -374,7 +374,7 @@ defmodule Plausible.Imported.CSVImporterTest do
|
||||||
|
|
||||||
uploads =
|
uploads =
|
||||||
for %{name: name, body: body} <- csvs do
|
for %{name: name, body: body} <- csvs do
|
||||||
on_full_build do
|
on_ee do
|
||||||
%{s3_url: s3_url} = Plausible.S3.import_presign_upload(site.id, name)
|
%{s3_url: s3_url} = Plausible.S3.import_presign_upload(site.id, name)
|
||||||
[bucket, key] = String.split(URI.parse(s3_url).path, "/", parts: 2)
|
[bucket, key] = String.split(URI.parse(s3_url).path, "/", parts: 2)
|
||||||
ExAws.request!(ExAws.S3.put_object(bucket, key, body))
|
ExAws.request!(ExAws.S3.put_object(bucket, key, body))
|
||||||
|
|
@ -393,7 +393,7 @@ defmodule Plausible.Imported.CSVImporterTest do
|
||||||
start_date: date_range.first,
|
start_date: date_range.first,
|
||||||
end_date: date_range.last,
|
end_date: date_range.last,
|
||||||
uploads: uploads,
|
uploads: uploads,
|
||||||
storage: on_full_build(do: "s3", else: "local")
|
storage: on_ee(do: "s3", else: "local")
|
||||||
)
|
)
|
||||||
|
|
||||||
assert %{discard: 1} = Oban.drain_queue(queue: :analytics_imports, with_safety?: false)
|
assert %{discard: 1} = Oban.drain_queue(queue: :analytics_imports, with_safety?: false)
|
||||||
|
|
@ -479,7 +479,7 @@ defmodule Plausible.Imported.CSVImporterTest do
|
||||||
])
|
])
|
||||||
|
|
||||||
# export archive to s3
|
# export archive to s3
|
||||||
on_full_build do
|
on_ee do
|
||||||
assert {:ok, _job} = Plausible.Exports.schedule_s3_export(site.id, user.email)
|
assert {:ok, _job} = Plausible.Exports.schedule_s3_export(site.id, user.email)
|
||||||
else
|
else
|
||||||
assert {:ok, %{args: %{"local_path" => local_path}}} =
|
assert {:ok, %{args: %{"local_path" => local_path}}} =
|
||||||
|
|
@ -489,7 +489,7 @@ defmodule Plausible.Imported.CSVImporterTest do
|
||||||
assert %{success: 1} = Oban.drain_queue(queue: :analytics_exports, with_safety: false)
|
assert %{success: 1} = Oban.drain_queue(queue: :analytics_exports, with_safety: false)
|
||||||
|
|
||||||
# download archive
|
# download archive
|
||||||
on_full_build do
|
on_ee do
|
||||||
ExAws.request!(
|
ExAws.request!(
|
||||||
ExAws.S3.download_file(
|
ExAws.S3.download_file(
|
||||||
Plausible.S3.exports_bucket(),
|
Plausible.S3.exports_bucket(),
|
||||||
|
|
@ -508,7 +508,7 @@ defmodule Plausible.Imported.CSVImporterTest do
|
||||||
# upload csvs
|
# upload csvs
|
||||||
uploads =
|
uploads =
|
||||||
Enum.map(files, fn file ->
|
Enum.map(files, fn file ->
|
||||||
on_full_build do
|
on_ee do
|
||||||
%{s3_url: s3_url} = Plausible.S3.import_presign_upload(site.id, file)
|
%{s3_url: s3_url} = Plausible.S3.import_presign_upload(site.id, file)
|
||||||
[bucket, key] = String.split(URI.parse(s3_url).path, "/", parts: 2)
|
[bucket, key] = String.split(URI.parse(s3_url).path, "/", parts: 2)
|
||||||
ExAws.request!(ExAws.S3.put_object(bucket, key, File.read!(file)))
|
ExAws.request!(ExAws.S3.put_object(bucket, key, File.read!(file)))
|
||||||
|
|
@ -526,7 +526,7 @@ defmodule Plausible.Imported.CSVImporterTest do
|
||||||
start_date: date_range.first,
|
start_date: date_range.first,
|
||||||
end_date: date_range.last,
|
end_date: date_range.last,
|
||||||
uploads: uploads,
|
uploads: uploads,
|
||||||
storage: on_full_build(do: "s3", else: "local")
|
storage: on_ee(do: "s3", else: "local")
|
||||||
)
|
)
|
||||||
|
|
||||||
assert %{success: 1} = Oban.drain_queue(queue: :analytics_imports, with_safety: false)
|
assert %{success: 1} = Oban.drain_queue(queue: :analytics_imports, with_safety: false)
|
||||||
|
|
@ -544,7 +544,7 @@ defmodule Plausible.Imported.CSVImporterTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp clean_buckets(_context) do
|
defp clean_buckets(_context) do
|
||||||
on_full_build do
|
on_ee do
|
||||||
clean_bucket = fn bucket ->
|
clean_bucket = fn bucket ->
|
||||||
ExAws.S3.list_objects_v2(bucket)
|
ExAws.S3.list_objects_v2(bucket)
|
||||||
|> ExAws.stream!()
|
|> ExAws.stream!()
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,7 @@ defmodule Plausible.Ingestion.EventTest do
|
||||||
assert dropped.drop_reason == :payment_required
|
assert dropped.drop_reason == :payment_required
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "saves revenue amount" do
|
test "saves revenue amount" do
|
||||||
site = insert(:site)
|
site = insert(:site)
|
||||||
_goal = insert(:goal, event_name: "checkout", currency: "USD", site: site)
|
_goal = insert(:goal, event_name: "checkout", currency: "USD", site: site)
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ defmodule Plausible.Ingestion.RequestTest do
|
||||||
assert request.props["custom2"] == "property2"
|
assert request.props["custom2"] == "property2"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "parses revenue source field from a json string" do
|
test "parses revenue source field from a json string" do
|
||||||
payload = %{
|
payload = %{
|
||||||
name: "pageview",
|
name: "pageview",
|
||||||
|
|
@ -187,7 +187,7 @@ defmodule Plausible.Ingestion.RequestTest do
|
||||||
assert Decimal.new("20.2") == amount
|
assert Decimal.new("20.2") == amount
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "sets revenue source with integer amount" do
|
test "sets revenue source with integer amount" do
|
||||||
payload = %{
|
payload = %{
|
||||||
name: "pageview",
|
name: "pageview",
|
||||||
|
|
@ -206,7 +206,7 @@ defmodule Plausible.Ingestion.RequestTest do
|
||||||
assert Decimal.equal?(amount, Decimal.new("20.0"))
|
assert Decimal.equal?(amount, Decimal.new("20.0"))
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "sets revenue source with float amount" do
|
test "sets revenue source with float amount" do
|
||||||
payload = %{
|
payload = %{
|
||||||
name: "pageview",
|
name: "pageview",
|
||||||
|
|
@ -225,7 +225,7 @@ defmodule Plausible.Ingestion.RequestTest do
|
||||||
assert Decimal.equal?(amount, Decimal.new("20.1"))
|
assert Decimal.equal?(amount, Decimal.new("20.1"))
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "parses string amounts into money structs" do
|
test "parses string amounts into money structs" do
|
||||||
payload = %{
|
payload = %{
|
||||||
name: "pageview",
|
name: "pageview",
|
||||||
|
|
@ -244,7 +244,7 @@ defmodule Plausible.Ingestion.RequestTest do
|
||||||
assert Decimal.equal?(amount, Decimal.new("12.3"))
|
assert Decimal.equal?(amount, Decimal.new("12.3"))
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "ignores revenue data when currency is invalid" do
|
test "ignores revenue data when currency is invalid" do
|
||||||
payload = %{
|
payload = %{
|
||||||
name: "pageview",
|
name: "pageview",
|
||||||
|
|
@ -429,7 +429,7 @@ defmodule Plausible.Ingestion.RequestTest do
|
||||||
assert changeset.errors[:request]
|
assert changeset.errors[:request]
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "encodable" do
|
test "encodable" do
|
||||||
params = %{
|
params = %{
|
||||||
name: "pageview",
|
name: "pageview",
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ defmodule Plausible.Plugins.API.TokenTest do
|
||||||
|
|
||||||
alias Plausible.Plugins.API.Token
|
alias Plausible.Plugins.API.Token
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "basic token properties" do
|
test "basic token properties" do
|
||||||
t1 = Token.generate()
|
t1 = Token.generate()
|
||||||
t2 = Token.generate()
|
t2 = Token.generate()
|
||||||
|
|
@ -25,23 +25,23 @@ defmodule Plausible.Plugins.API.TokenTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "prefix/0" do
|
describe "prefix/0" do
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "default prefix - full build" do
|
test "default prefix - full build" do
|
||||||
assert Token.prefix() == "plausible-plugin-test"
|
assert Token.prefix() == "plausible-plugin-test"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :small_build_only
|
@tag :ce_build_only
|
||||||
test "selfhosted prefix" do
|
test "selfhosted prefix" do
|
||||||
assert Token.prefix() == "plausible-plugin-selfhost"
|
assert Token.prefix() == "plausible-plugin-selfhost"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "prod prefix" do
|
test "prod prefix" do
|
||||||
patch_env(:environment, "prod")
|
patch_env(:environment, "prod")
|
||||||
assert Token.prefix() == "plausible-plugin"
|
assert Token.prefix() == "plausible-plugin"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "staging prefix" do
|
test "staging prefix" do
|
||||||
patch_env(:environment, "staging")
|
patch_env(:environment, "staging")
|
||||||
assert Token.prefix() == "plausible-plugin-staging"
|
assert Token.prefix() == "plausible-plugin-staging"
|
||||||
|
|
|
||||||
|
|
@ -4,25 +4,25 @@ defmodule Plausible.ReleaseTest do
|
||||||
import ExUnit.CaptureIO
|
import ExUnit.CaptureIO
|
||||||
|
|
||||||
describe "should_be_first_launch?/0" do
|
describe "should_be_first_launch?/0" do
|
||||||
@tag :small_build_only
|
@tag :ce_build_only
|
||||||
test "returns true when self-hosted and no users" do
|
test "returns true when self-hosted and no users" do
|
||||||
refute Repo.exists?(Auth.User)
|
refute Repo.exists?(Auth.User)
|
||||||
assert Release.should_be_first_launch?()
|
assert Release.should_be_first_launch?()
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "returns false when not self-hosted and has no users" do
|
test "returns false when not self-hosted and has no users" do
|
||||||
refute Repo.exists?(Auth.User)
|
refute Repo.exists?(Auth.User)
|
||||||
refute Release.should_be_first_launch?()
|
refute Release.should_be_first_launch?()
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "returns false when not self-hosted and has users" do
|
test "returns false when not self-hosted and has users" do
|
||||||
insert(:user)
|
insert(:user)
|
||||||
refute Release.should_be_first_launch?()
|
refute Release.should_be_first_launch?()
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :small_build_only
|
@tag :ce_build_only
|
||||||
test "returns false when self-hosted and has users" do
|
test "returns false when self-hosted and has users" do
|
||||||
insert(:user)
|
insert(:user)
|
||||||
refute Release.should_be_first_launch?()
|
refute Release.should_be_first_launch?()
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ defmodule Plausible.Site.AdminTest do
|
||||||
action.(conn, [site], %{"email" => current_owner.email})
|
action.(conn, [site], %{"email" => current_owner.email})
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "new owner's plan must accommodate the transferred site", %{
|
test "new owner's plan must accommodate the transferred site", %{
|
||||||
conn: conn,
|
conn: conn,
|
||||||
transfer_direct_action: action
|
transfer_direct_action: action
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ defmodule Plausible.Site.CacheTest do
|
||||||
refute Cache.get("site3.example.com", cache_name: test, force?: true)
|
refute Cache.get("site3.example.com", cache_name: test, force?: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "cache caches revenue goals", %{test: test} do
|
test "cache caches revenue goals", %{test: test} do
|
||||||
{:ok, _} =
|
{:ok, _} =
|
||||||
Supervisor.start_link(
|
Supervisor.start_link(
|
||||||
|
|
@ -83,7 +83,7 @@ defmodule Plausible.Site.CacheTest do
|
||||||
] = Enum.sort_by(cached_goals, & &1.event_name)
|
] = Enum.sort_by(cached_goals, & &1.event_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "cache caches revenue goals with event refresh", %{test: test} do
|
test "cache caches revenue goals with event refresh", %{test: test} do
|
||||||
{:ok, _} =
|
{:ok, _} =
|
||||||
Supervisor.start_link(
|
Supervisor.start_link(
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do
|
||||||
assert_no_emails_delivered()
|
assert_no_emails_delivered()
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "unlocks the site if it was previously locked" do
|
test "unlocks the site if it was previously locked" do
|
||||||
site = insert(:site, locked: true, memberships: [])
|
site = insert(:site, locked: true, memberships: [])
|
||||||
existing_owner = insert(:user)
|
existing_owner = insert(:user)
|
||||||
|
|
@ -86,7 +86,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do
|
||||||
assert Repo.reload!(owner).trial_expiry_date == nil
|
assert Repo.reload!(owner).trial_expiry_date == nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "does not allow transferring to an account without an active subscription" do
|
test "does not allow transferring to an account without an active subscription" do
|
||||||
current_owner = insert(:user)
|
current_owner = insert(:user)
|
||||||
site = insert(:site, members: [current_owner])
|
site = insert(:site, members: [current_owner])
|
||||||
|
|
@ -131,7 +131,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do
|
||||||
AcceptInvitation.transfer_ownership(site, current_owner)
|
AcceptInvitation.transfer_ownership(site, current_owner)
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "does not allow transferring to and account without suitable plan" do
|
test "does not allow transferring to and account without suitable plan" do
|
||||||
current_owner = insert(:user)
|
current_owner = insert(:user)
|
||||||
site = insert(:site, members: [current_owner])
|
site = insert(:site, members: [current_owner])
|
||||||
|
|
@ -146,7 +146,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do
|
||||||
AcceptInvitation.transfer_ownership(site, new_owner)
|
AcceptInvitation.transfer_ownership(site, new_owner)
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :small_build_only
|
@tag :ce_build_only
|
||||||
test "allows transferring to an account without a subscription on self hosted" do
|
test "allows transferring to an account without a subscription on self hosted" do
|
||||||
current_owner = insert(:user)
|
current_owner = insert(:user)
|
||||||
site = insert(:site, members: [current_owner])
|
site = insert(:site, members: [current_owner])
|
||||||
|
|
@ -315,7 +315,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "unlocks a previously locked site after transfer" do
|
test "unlocks a previously locked site after transfer" do
|
||||||
site = insert(:site, locked: true, memberships: [])
|
site = insert(:site, locked: true, memberships: [])
|
||||||
existing_owner = insert(:user)
|
existing_owner = insert(:user)
|
||||||
|
|
@ -405,7 +405,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do
|
||||||
refute Repo.reload(invitation)
|
refute Repo.reload(invitation)
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "does not allow transferring ownership to a non-member user when at team members limit" do
|
test "does not allow transferring ownership to a non-member user when at team members limit" do
|
||||||
old_owner = insert(:user, subscription: build(:business_subscription))
|
old_owner = insert(:user, subscription: build(:business_subscription))
|
||||||
new_owner = insert(:user, subscription: build(:growth_subscription))
|
new_owner = insert(:user, subscription: build(:growth_subscription))
|
||||||
|
|
@ -432,7 +432,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "allows transferring ownership to existing site member when at team members limit" do
|
test "allows transferring ownership to existing site member when at team members limit" do
|
||||||
old_owner = insert(:user, subscription: build(:business_subscription))
|
old_owner = insert(:user, subscription: build(:business_subscription))
|
||||||
new_owner = insert(:user, subscription: build(:growth_subscription))
|
new_owner = insert(:user, subscription: build(:growth_subscription))
|
||||||
|
|
@ -462,7 +462,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "does not allow transferring ownership when sites limit exceeded" do
|
test "does not allow transferring ownership when sites limit exceeded" do
|
||||||
old_owner = insert(:user, subscription: build(:business_subscription))
|
old_owner = insert(:user, subscription: build(:business_subscription))
|
||||||
new_owner = insert(:user, subscription: build(:growth_subscription))
|
new_owner = insert(:user, subscription: build(:growth_subscription))
|
||||||
|
|
@ -486,7 +486,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "does not allow transferring ownership when pageview limit exceeded" do
|
test "does not allow transferring ownership when pageview limit exceeded" do
|
||||||
old_owner = insert(:user, subscription: build(:business_subscription))
|
old_owner = insert(:user, subscription: build(:business_subscription))
|
||||||
new_owner = insert(:user, subscription: build(:growth_subscription))
|
new_owner = insert(:user, subscription: build(:growth_subscription))
|
||||||
|
|
@ -515,7 +515,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do
|
||||||
AcceptInvitation.accept_invitation(invitation.invitation_id, new_owner)
|
AcceptInvitation.accept_invitation(invitation.invitation_id, new_owner)
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "allow_next_upgrade_override field has no effect when checking the pageview limit on ownership transfer" do
|
test "allow_next_upgrade_override field has no effect when checking the pageview limit on ownership transfer" do
|
||||||
old_owner = insert(:user, subscription: build(:business_subscription))
|
old_owner = insert(:user, subscription: build(:business_subscription))
|
||||||
|
|
||||||
|
|
@ -549,7 +549,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do
|
||||||
AcceptInvitation.accept_invitation(invitation.invitation_id, new_owner)
|
AcceptInvitation.accept_invitation(invitation.invitation_id, new_owner)
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "does not allow transferring ownership when many limits exceeded at once" do
|
test "does not allow transferring ownership when many limits exceeded at once" do
|
||||||
old_owner = insert(:user, subscription: build(:business_subscription))
|
old_owner = insert(:user, subscription: build(:business_subscription))
|
||||||
new_owner = insert(:user, subscription: build(:growth_subscription))
|
new_owner = insert(:user, subscription: build(:growth_subscription))
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ defmodule Plausible.Site.Memberships.CreateInvitationTest do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "returns error when owner is over their team member limit" do
|
test "returns error when owner is over their team member limit" do
|
||||||
[owner, inviter, invitee] = insert_list(3, :user)
|
[owner, inviter, invitee] = insert_list(3, :user)
|
||||||
|
|
||||||
|
|
@ -82,7 +82,7 @@ defmodule Plausible.Site.Memberships.CreateInvitationTest do
|
||||||
CreateInvitation.create_invitation(site, inviter, invitee.email, :viewer)
|
CreateInvitation.create_invitation(site, inviter, invitee.email, :viewer)
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "allows inviting users who were already invited to other sites, within the limit" do
|
test "allows inviting users who were already invited to other sites, within the limit" do
|
||||||
owner = insert(:user)
|
owner = insert(:user)
|
||||||
|
|
||||||
|
|
@ -107,7 +107,7 @@ defmodule Plausible.Site.Memberships.CreateInvitationTest do
|
||||||
assert {:ok, _} = invite.(site2, "i3@example.com")
|
assert {:ok, _} = invite.(site2, "i3@example.com")
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "allows inviting users who are already members of other sites, within the limit" do
|
test "allows inviting users who are already members of other sites, within the limit" do
|
||||||
[u1, u2, u3, u4] = insert_list(4, :user)
|
[u1, u2, u3, u4] = insert_list(4, :user)
|
||||||
|
|
||||||
|
|
@ -385,7 +385,7 @@ defmodule Plausible.Site.Memberships.CreateInvitationTest do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "does not allow transferring ownership to a non-member user when at team members limit" do
|
test "does not allow transferring ownership to a non-member user when at team members limit" do
|
||||||
old_owner = insert(:user, subscription: build(:business_subscription))
|
old_owner = insert(:user, subscription: build(:business_subscription))
|
||||||
new_owner = insert(:user, subscription: build(:growth_subscription))
|
new_owner = insert(:user, subscription: build(:growth_subscription))
|
||||||
|
|
@ -401,7 +401,7 @@ defmodule Plausible.Site.Memberships.CreateInvitationTest do
|
||||||
CreateInvitation.bulk_transfer_ownership_direct([site], new_owner)
|
CreateInvitation.bulk_transfer_ownership_direct([site], new_owner)
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "allows transferring ownership to existing site member when at team members limit" do
|
test "allows transferring ownership to existing site member when at team members limit" do
|
||||||
old_owner = insert(:user, subscription: build(:business_subscription))
|
old_owner = insert(:user, subscription: build(:business_subscription))
|
||||||
new_owner = insert(:user, subscription: build(:growth_subscription))
|
new_owner = insert(:user, subscription: build(:growth_subscription))
|
||||||
|
|
@ -420,7 +420,7 @@ defmodule Plausible.Site.Memberships.CreateInvitationTest do
|
||||||
CreateInvitation.bulk_transfer_ownership_direct([site], new_owner)
|
CreateInvitation.bulk_transfer_ownership_direct([site], new_owner)
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "does not allow transferring ownership when sites limit exceeded" do
|
test "does not allow transferring ownership when sites limit exceeded" do
|
||||||
old_owner = insert(:user, subscription: build(:business_subscription))
|
old_owner = insert(:user, subscription: build(:business_subscription))
|
||||||
new_owner = insert(:user, subscription: build(:growth_subscription))
|
new_owner = insert(:user, subscription: build(:growth_subscription))
|
||||||
|
|
@ -433,7 +433,7 @@ defmodule Plausible.Site.Memberships.CreateInvitationTest do
|
||||||
CreateInvitation.bulk_transfer_ownership_direct([site], new_owner)
|
CreateInvitation.bulk_transfer_ownership_direct([site], new_owner)
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "exceeding limits error takes precedence over missing features" do
|
test "exceeding limits error takes precedence over missing features" do
|
||||||
old_owner = insert(:user, subscription: build(:business_subscription))
|
old_owner = insert(:user, subscription: build(:business_subscription))
|
||||||
new_owner = insert(:user, subscription: build(:growth_subscription))
|
new_owner = insert(:user, subscription: build(:growth_subscription))
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ defmodule Plausible.SitesTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "get_for_user/2" do
|
describe "get_for_user/2" do
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "get site for super_admin" do
|
test "get site for super_admin" do
|
||||||
user1 = insert(:user)
|
user1 = insert(:user)
|
||||||
user2 = insert(:user)
|
user2 = insert(:user)
|
||||||
|
|
|
||||||
|
|
@ -177,13 +177,13 @@ defmodule Plausible.Stats.QueryTest do
|
||||||
assert q.interval == "date"
|
assert q.interval == "date"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "adds sample_threshold :infinite to query struct", %{site: site} do
|
test "adds sample_threshold :infinite to query struct", %{site: site} do
|
||||||
q = Query.from(site, %{"period" => "30d", "sample_threshold" => "infinite"})
|
q = Query.from(site, %{"period" => "30d", "sample_threshold" => "infinite"})
|
||||||
assert q.sample_threshold == :infinite
|
assert q.sample_threshold == :infinite
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "casts sample_threshold to integer in query struct", %{site: site} do
|
test "casts sample_threshold to integer in query struct", %{site: site} do
|
||||||
q = Query.from(site, %{"period" => "30d", "sample_threshold" => "30000000"})
|
q = Query.from(site, %{"period" => "30d", "sample_threshold" => "30000000"})
|
||||||
assert q.sample_threshold == 30_000_000
|
assert q.sample_threshold == 30_000_000
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ defmodule PlausibleWeb.Components.Billing.NoticeTest do
|
||||||
assert rendered =~ "please reach out to the site owner to upgrade their subscription"
|
assert rendered =~ "please reach out to the site owner to upgrade their subscription"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "limit_exceeded/1 when billable user is on trial displays upgrade link" do
|
test "limit_exceeded/1 when billable user is on trial displays upgrade link" do
|
||||||
me = insert(:user)
|
me = insert(:user)
|
||||||
|
|
||||||
|
|
@ -104,7 +104,7 @@ defmodule PlausibleWeb.Components.Billing.NoticeTest do
|
||||||
assert rendered =~ "/billing/choose-plan"
|
assert rendered =~ "/billing/choose-plan"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "limit_exceeded/1 when billable user is on an enterprise plan displays support email" do
|
test "limit_exceeded/1 when billable user is on an enterprise plan displays support email" do
|
||||||
me =
|
me =
|
||||||
insert(:user,
|
insert(:user,
|
||||||
|
|
@ -126,7 +126,7 @@ defmodule PlausibleWeb.Components.Billing.NoticeTest do
|
||||||
assert rendered =~ "upgrade your subscription"
|
assert rendered =~ "upgrade your subscription"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "limit_exceeded/1 when billable user is on a business plan displays support email" do
|
test "limit_exceeded/1 when billable user is on a business plan displays support email" do
|
||||||
me = insert(:user, subscription: build(:business_subscription))
|
me = insert(:user, subscription: build(:business_subscription))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ defmodule PlausibleWeb.AdminAuthControllerTest do
|
||||||
alias Plausible.Release
|
alias Plausible.Release
|
||||||
|
|
||||||
describe "GET /" do
|
describe "GET /" do
|
||||||
@describetag :small_build_only
|
@describetag :ce_build_only
|
||||||
test "disable registration", %{conn: conn} do
|
test "disable registration", %{conn: conn} do
|
||||||
insert(:user)
|
insert(:user)
|
||||||
patch_config(disable_registration: true)
|
patch_config(disable_registration: true)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ defmodule PlausibleWeb.AdminControllerTest do
|
||||||
describe "GET /crm/auth/user/:user_id/usage" do
|
describe "GET /crm/auth/user/:user_id/usage" do
|
||||||
setup [:create_user, :log_in]
|
setup [:create_user, :log_in]
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "returns 403 if the logged in user is not a super admin", %{conn: conn} do
|
test "returns 403 if the logged in user is not a super admin", %{conn: conn} do
|
||||||
conn = get(conn, "/crm/auth/user/1/usage")
|
conn = get(conn, "/crm/auth/user/1/usage")
|
||||||
assert response(conn, 403) == "Not allowed"
|
assert response(conn, 403) == "Not allowed"
|
||||||
|
|
@ -16,7 +16,7 @@ defmodule PlausibleWeb.AdminControllerTest do
|
||||||
describe "POST /crm/sites/site/:site_id" do
|
describe "POST /crm/sites/site/:site_id" do
|
||||||
setup [:create_user, :log_in]
|
setup [:create_user, :log_in]
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "resets stats start date on native stats start time change", %{conn: conn, user: user} do
|
test "resets stats start date on native stats start time change", %{conn: conn, user: user} do
|
||||||
patch_env(:super_admin_user_ids, [user.id])
|
patch_env(:super_admin_user_ids, [user.id])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -727,7 +727,7 @@ defmodule PlausibleWeb.Api.ExternalControllerTest do
|
||||||
assert Map.get(event, :"meta.value") == ["true"]
|
assert Map.get(event, :"meta.value") == ["true"]
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "converts revenue values into the goal currency", %{conn: conn, site: site} do
|
test "converts revenue values into the goal currency", %{conn: conn, site: site} do
|
||||||
params = %{
|
params = %{
|
||||||
name: "Payment",
|
name: "Payment",
|
||||||
|
|
@ -744,7 +744,7 @@ defmodule PlausibleWeb.Api.ExternalControllerTest do
|
||||||
assert Decimal.equal?(Decimal.new("7.14"), amount)
|
assert Decimal.equal?(Decimal.new("7.14"), amount)
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "revenue values can be sent with minified keys", %{conn: conn, site: site} do
|
test "revenue values can be sent with minified keys", %{conn: conn, site: site} do
|
||||||
params = %{
|
params = %{
|
||||||
"n" => "Payment",
|
"n" => "Payment",
|
||||||
|
|
@ -761,7 +761,7 @@ defmodule PlausibleWeb.Api.ExternalControllerTest do
|
||||||
assert Decimal.equal?(Decimal.new("7.14"), amount)
|
assert Decimal.equal?(Decimal.new("7.14"), amount)
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "saves the exact same amount when goal currency is the same as the event", %{
|
test "saves the exact same amount when goal currency is the same as the event", %{
|
||||||
conn: conn,
|
conn: conn,
|
||||||
site: site
|
site: site
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ defmodule PlausibleWeb.Api.ExternalSitesControllerTest do
|
||||||
use PlausibleWeb.ConnCase, async: false
|
use PlausibleWeb.ConnCase, async: false
|
||||||
use Plausible.Repo
|
use Plausible.Repo
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
setup :create_user
|
setup :create_user
|
||||||
|
|
||||||
setup %{conn: conn, user: user} do
|
setup %{conn: conn, user: user} do
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ defmodule PlausibleWeb.Api.ExternalStatsController.AuthTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "super admin access" do
|
describe "super admin access" do
|
||||||
@describetag :full_build_only
|
@describetag :ee_only
|
||||||
setup %{user: user} do
|
setup %{user: user} do
|
||||||
patch_env(:super_admin_user_ids, [user.id])
|
patch_env(:super_admin_user_ids, [user.id])
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ defmodule PlausibleWeb.Api.InternalController.SyncTest do
|
||||||
describe "PUT /api/:domain/disable-feature" do
|
describe "PUT /api/:domain/disable-feature" do
|
||||||
setup [:create_user, :log_in]
|
setup [:create_user, :log_in]
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "when the logged-in user is an super-admin", %{conn: conn, user: user} do
|
test "when the logged-in user is an super-admin", %{conn: conn, user: user} do
|
||||||
site = insert(:site)
|
site = insert(:site)
|
||||||
patch_env(:super_admin_user_ids, [user.id])
|
patch_env(:super_admin_user_ids, [user.id])
|
||||||
|
|
|
||||||
|
|
@ -265,7 +265,7 @@ defmodule PlausibleWeb.Api.StatsController.ConversionsTest do
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "returns formatted average and total values for a conversion with revenue value", %{
|
test "returns formatted average and total values for a conversion with revenue value", %{
|
||||||
conn: conn,
|
conn: conn,
|
||||||
site: site
|
site: site
|
||||||
|
|
@ -306,7 +306,7 @@ defmodule PlausibleWeb.Api.StatsController.ConversionsTest do
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "returns revenue goals as custom events if the plan doesn't cover the feature", %{
|
test "returns revenue goals as custom events if the plan doesn't cover the feature", %{
|
||||||
conn: conn,
|
conn: conn,
|
||||||
site: site,
|
site: site,
|
||||||
|
|
@ -350,7 +350,7 @@ defmodule PlausibleWeb.Api.StatsController.ConversionsTest do
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "returns revenue metrics as nil for non-revenue goals", %{
|
test "returns revenue metrics as nil for non-revenue goals", %{
|
||||||
conn: conn,
|
conn: conn,
|
||||||
site: site
|
site: site
|
||||||
|
|
|
||||||
|
|
@ -745,7 +745,7 @@ defmodule PlausibleWeb.Api.StatsController.CustomPropBreakdownTest do
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "returns revenue metrics when filtering by a revenue goal", %{conn: conn, site: site} do
|
test "returns revenue metrics when filtering by a revenue goal", %{conn: conn, site: site} do
|
||||||
prop_key = "logged_in"
|
prop_key = "logged_in"
|
||||||
|
|
||||||
|
|
@ -803,7 +803,7 @@ defmodule PlausibleWeb.Api.StatsController.CustomPropBreakdownTest do
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "returns revenue metrics when filtering by many revenue goals with same currency", %{
|
test "returns revenue metrics when filtering by many revenue goals with same currency", %{
|
||||||
conn: conn,
|
conn: conn,
|
||||||
site: site
|
site: site
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
defmodule PlausibleWeb.Api.StatsController.FunnelsTest do
|
defmodule PlausibleWeb.Api.StatsController.FunnelsTest do
|
||||||
use PlausibleWeb.ConnCase, async: true
|
use PlausibleWeb.ConnCase, async: true
|
||||||
use Plausible
|
use Plausible
|
||||||
@moduletag :full_build_only
|
@moduletag :ee_only
|
||||||
|
|
||||||
on_full_build do
|
on_ee do
|
||||||
@user_id 123
|
@user_id 123
|
||||||
@other_user_id 456
|
@other_user_id 456
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1101,7 +1101,7 @@ defmodule PlausibleWeb.Api.StatsController.MainGraphTest do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
describe "GET /api/stats/main-graph - total_revenue plot" do
|
describe "GET /api/stats/main-graph - total_revenue plot" do
|
||||||
setup [:create_user, :log_in, :create_new_site, :create_legacy_site_import]
|
setup [:create_user, :log_in, :create_new_site, :create_legacy_site_import]
|
||||||
|
|
||||||
|
|
@ -1181,7 +1181,7 @@ defmodule PlausibleWeb.Api.StatsController.MainGraphTest do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
describe "GET /api/stats/main-graph - average_revenue plot" do
|
describe "GET /api/stats/main-graph - average_revenue plot" do
|
||||||
setup [:create_user, :log_in, :create_new_site, :create_legacy_site_import]
|
setup [:create_user, :log_in, :create_new_site, :create_legacy_site_import]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1102,7 +1102,7 @@ defmodule PlausibleWeb.Api.StatsController.TopStatsTest do
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "returns average and total when filtering by a revenue goal", %{conn: conn, site: site} do
|
test "returns average and total when filtering by a revenue goal", %{conn: conn, site: site} do
|
||||||
insert(:goal, site: site, event_name: "Payment", currency: "USD")
|
insert(:goal, site: site, event_name: "Payment", currency: "USD")
|
||||||
insert(:goal, site: site, event_name: "AddToCart", currency: "EUR")
|
insert(:goal, site: site, event_name: "AddToCart", currency: "EUR")
|
||||||
|
|
@ -1147,7 +1147,7 @@ defmodule PlausibleWeb.Api.StatsController.TopStatsTest do
|
||||||
} in top_stats
|
} in top_stats
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "returns average and total when filtering by many revenue goals with same currency", %{
|
test "returns average and total when filtering by many revenue goals with same currency", %{
|
||||||
conn: conn,
|
conn: conn,
|
||||||
site: site
|
site: site
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ defmodule PlausibleWeb.AuthControllerSyncTest do
|
||||||
describe "PUT /settings/email" do
|
describe "PUT /settings/email" do
|
||||||
setup [:create_user, :log_in]
|
setup [:create_user, :log_in]
|
||||||
|
|
||||||
@tag :small_build_only
|
@tag :ce_build_only
|
||||||
test "updates email but DOES NOT force reverification when feature disabled", %{
|
test "updates email but DOES NOT force reverification when feature disabled", %{
|
||||||
conn: conn,
|
conn: conn,
|
||||||
user: user
|
user: user
|
||||||
|
|
|
||||||
|
|
@ -526,7 +526,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||||
assert resp =~ "Change email address"
|
assert resp =~ "Change email address"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "shows subscription", %{conn: conn, user: user} do
|
test "shows subscription", %{conn: conn, user: user} do
|
||||||
insert(:subscription, paddle_plan_id: "558018", user: user)
|
insert(:subscription, paddle_plan_id: "558018", user: user)
|
||||||
conn = get(conn, "/settings")
|
conn = get(conn, "/settings")
|
||||||
|
|
@ -534,7 +534,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||||
assert html_response(conn, 200) =~ "monthly billing"
|
assert html_response(conn, 200) =~ "monthly billing"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "shows yearly subscription", %{conn: conn, user: user} do
|
test "shows yearly subscription", %{conn: conn, user: user} do
|
||||||
insert(:subscription, paddle_plan_id: "590752", user: user)
|
insert(:subscription, paddle_plan_id: "590752", user: user)
|
||||||
conn = get(conn, "/settings")
|
conn = get(conn, "/settings")
|
||||||
|
|
@ -542,7 +542,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||||
assert html_response(conn, 200) =~ "yearly billing"
|
assert html_response(conn, 200) =~ "yearly billing"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "shows free subscription", %{conn: conn, user: user} do
|
test "shows free subscription", %{conn: conn, user: user} do
|
||||||
insert(:subscription, paddle_plan_id: "free_10k", user: user)
|
insert(:subscription, paddle_plan_id: "free_10k", user: user)
|
||||||
conn = get(conn, "/settings")
|
conn = get(conn, "/settings")
|
||||||
|
|
@ -550,7 +550,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||||
assert html_response(conn, 200) =~ "N/A billing"
|
assert html_response(conn, 200) =~ "N/A billing"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "shows enterprise plan subscription", %{conn: conn, user: user} do
|
test "shows enterprise plan subscription", %{conn: conn, user: user} do
|
||||||
insert(:subscription, paddle_plan_id: "123", user: user)
|
insert(:subscription, paddle_plan_id: "123", user: user)
|
||||||
|
|
||||||
|
|
@ -561,7 +561,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||||
assert html_response(conn, 200) =~ "yearly billing"
|
assert html_response(conn, 200) =~ "yearly billing"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "shows current enterprise plan subscription when user has a new one to upgrade to", %{
|
test "shows current enterprise plan subscription when user has a new one to upgrade to", %{
|
||||||
conn: conn,
|
conn: conn,
|
||||||
user: user
|
user: user
|
||||||
|
|
@ -585,7 +585,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||||
assert html_response(conn, 200) =~ "yearly billing"
|
assert html_response(conn, 200) =~ "yearly billing"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "renders two links to '/billing/choose-plan` with the text 'Upgrade'", %{conn: conn} do
|
test "renders two links to '/billing/choose-plan` with the text 'Upgrade'", %{conn: conn} do
|
||||||
doc =
|
doc =
|
||||||
get(conn, "/settings")
|
get(conn, "/settings")
|
||||||
|
|
@ -601,7 +601,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||||
assert text_of_attr(upgrade_link_2, "href") == Routes.billing_path(conn, :choose_plan)
|
assert text_of_attr(upgrade_link_2, "href") == Routes.billing_path(conn, :choose_plan)
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "renders a link to '/billing/choose-plan' with the text 'Change plan' + cancel link", %{
|
test "renders a link to '/billing/choose-plan' with the text 'Change plan' + cancel link", %{
|
||||||
conn: conn,
|
conn: conn,
|
||||||
user: user
|
user: user
|
||||||
|
|
@ -661,7 +661,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||||
refute element_exists?(doc, "#upgrade-or-change-plan-link")
|
refute element_exists?(doc, "#upgrade-or-change-plan-link")
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "renders two links to '/billing/choose-plan' with the text 'Upgrade' for a configured enterprise plan",
|
test "renders two links to '/billing/choose-plan' with the text 'Upgrade' for a configured enterprise plan",
|
||||||
%{conn: conn, user: user} do
|
%{conn: conn, user: user} do
|
||||||
configure_enterprise_plan(user)
|
configure_enterprise_plan(user)
|
||||||
|
|
@ -684,7 +684,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||||
Routes.billing_path(conn, :choose_plan)
|
Routes.billing_path(conn, :choose_plan)
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "links to '/billing/choose-plan' with the text 'Change plan' for a configured enterprise plan with an existing subscription + renders cancel button",
|
test "links to '/billing/choose-plan' with the text 'Change plan' for a configured enterprise plan with an existing subscription + renders cancel button",
|
||||||
%{conn: conn, user: user} do
|
%{conn: conn, user: user} do
|
||||||
insert(:subscription, paddle_plan_id: @v3_plan_id, user: user)
|
insert(:subscription, paddle_plan_id: @v3_plan_id, user: user)
|
||||||
|
|
@ -706,7 +706,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||||
Routes.billing_path(conn, :choose_plan)
|
Routes.billing_path(conn, :choose_plan)
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "renders cancelled subscription notice", %{conn: conn, user: user} do
|
test "renders cancelled subscription notice", %{conn: conn, user: user} do
|
||||||
insert(:subscription,
|
insert(:subscription,
|
||||||
paddle_plan_id: @v4_plan_id,
|
paddle_plan_id: @v4_plan_id,
|
||||||
|
|
@ -724,7 +724,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||||
assert notice_text =~ "Upgrade your subscription to get access to your stats again"
|
assert notice_text =~ "Upgrade your subscription to get access to your stats again"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "renders cancelled subscription notice with some subscription days still left", %{
|
test "renders cancelled subscription notice with some subscription days still left", %{
|
||||||
conn: conn,
|
conn: conn,
|
||||||
user: user
|
user: user
|
||||||
|
|
@ -746,7 +746,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||||
assert notice_text =~ "Upgrade your subscription to make sure you don't lose access"
|
assert notice_text =~ "Upgrade your subscription to make sure you don't lose access"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "renders cancelled subscription notice with a warning about losing grandfathering", %{
|
test "renders cancelled subscription notice with a warning about losing grandfathering", %{
|
||||||
conn: conn,
|
conn: conn,
|
||||||
user: user
|
user: user
|
||||||
|
|
@ -770,7 +770,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||||
"by letting your subscription expire, you lose access to our grandfathered terms"
|
"by letting your subscription expire, you lose access to our grandfathered terms"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "shows invoices for subscribed user", %{conn: conn, user: user} do
|
test "shows invoices for subscribed user", %{conn: conn, user: user} do
|
||||||
insert(:subscription,
|
insert(:subscription,
|
||||||
paddle_plan_id: "558018",
|
paddle_plan_id: "558018",
|
||||||
|
|
@ -785,7 +785,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||||
assert html_response(conn, 200) =~ "$22.00"
|
assert html_response(conn, 200) =~ "$22.00"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "shows 'something went wrong' on failed invoice request'", %{conn: conn, user: user} do
|
test "shows 'something went wrong' on failed invoice request'", %{conn: conn, user: user} do
|
||||||
insert(:subscription,
|
insert(:subscription,
|
||||||
paddle_plan_id: "558018",
|
paddle_plan_id: "558018",
|
||||||
|
|
@ -811,7 +811,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||||
refute html_response(conn, 200) =~ "Invoices"
|
refute html_response(conn, 200) =~ "Invoices"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "renders pageview usage for current, last, and penultimate billing cycles", %{
|
test "renders pageview usage for current, last, and penultimate billing cycles", %{
|
||||||
conn: conn,
|
conn: conn,
|
||||||
user: user
|
user: user
|
||||||
|
|
@ -876,7 +876,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||||
assert text_of_element(doc, "#custom_events_penultimate_cycle") =~ "Custom events 1"
|
assert text_of_element(doc, "#custom_events_penultimate_cycle") =~ "Custom events 1"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "renders pageview usage per billing cycle for active subscribers", %{
|
test "renders pageview usage per billing cycle for active subscribers", %{
|
||||||
conn: conn,
|
conn: conn,
|
||||||
user: user
|
user: user
|
||||||
|
|
@ -919,7 +919,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||||
get(conn, "/settings") |> html_response(200) |> assert_cycles_rendered.()
|
get(conn, "/settings") |> html_response(200) |> assert_cycles_rendered.()
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "penultimate cycle is disabled if there's no usage", %{conn: conn, user: user} do
|
test "penultimate cycle is disabled if there's no usage", %{conn: conn, user: user} do
|
||||||
site = insert(:site, members: [user])
|
site = insert(:site, members: [user])
|
||||||
|
|
||||||
|
|
@ -947,7 +947,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||||
assert text_of_element(doc, "#billing_cycle_tab_penultimate_cycle") =~ "Not available"
|
assert text_of_element(doc, "#billing_cycle_tab_penultimate_cycle") =~ "Not available"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "penultimate and last cycles are both disabled if there's no usage", %{
|
test "penultimate and last cycles are both disabled if there's no usage", %{
|
||||||
conn: conn,
|
conn: conn,
|
||||||
user: user
|
user: user
|
||||||
|
|
@ -982,7 +982,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||||
assert text_of_element(doc, "#billing_cycle_tab_penultimate_cycle") =~ "Not available"
|
assert text_of_element(doc, "#billing_cycle_tab_penultimate_cycle") =~ "Not available"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "when last cycle usage is 0, it's still not disabled if penultimate cycle has usage", %{
|
test "when last cycle usage is 0, it's still not disabled if penultimate cycle has usage", %{
|
||||||
conn: conn,
|
conn: conn,
|
||||||
user: user
|
user: user
|
||||||
|
|
@ -1016,7 +1016,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||||
refute text_of_element(doc, "#billing_cycle_tab_penultimate_cycle") =~ "Not available"
|
refute text_of_element(doc, "#billing_cycle_tab_penultimate_cycle") =~ "Not available"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "renders last 30 days pageview usage for trials and non-active/free_10k subscriptions",
|
test "renders last 30 days pageview usage for trials and non-active/free_10k subscriptions",
|
||||||
%{
|
%{
|
||||||
conn: conn,
|
conn: conn,
|
||||||
|
|
@ -1072,7 +1072,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||||
get(conn, "/settings") |> html_response(200) |> assert_usage.()
|
get(conn, "/settings") |> html_response(200) |> assert_usage.()
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "renders sites usage and limit", %{conn: conn, user: user} do
|
test "renders sites usage and limit", %{conn: conn, user: user} do
|
||||||
insert(:subscription, paddle_plan_id: @v3_plan_id, user: user)
|
insert(:subscription, paddle_plan_id: @v3_plan_id, user: user)
|
||||||
insert(:site, members: [user])
|
insert(:site, members: [user])
|
||||||
|
|
@ -1086,7 +1086,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||||
assert site_usage_row_text =~ "Owned sites 1 / 50"
|
assert site_usage_row_text =~ "Owned sites 1 / 50"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "renders team members usage and limit", %{conn: conn, user: user} do
|
test "renders team members usage and limit", %{conn: conn, user: user} do
|
||||||
insert(:subscription, paddle_plan_id: @v4_plan_id, user: user)
|
insert(:subscription, paddle_plan_id: @v4_plan_id, user: user)
|
||||||
|
|
||||||
|
|
@ -1099,7 +1099,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||||
assert team_member_usage_row_text =~ "Team members 0 / 3"
|
assert team_member_usage_row_text =~ "Team members 0 / 3"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "renders team member usage without limit if it's unlimited", %{conn: conn, user: user} do
|
test "renders team member usage without limit if it's unlimited", %{conn: conn, user: user} do
|
||||||
insert(:subscription, paddle_plan_id: @v3_plan_id, user: user)
|
insert(:subscription, paddle_plan_id: @v3_plan_id, user: user)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
defmodule PlausibleWeb.ErrorReportControllerTest do
|
defmodule PlausibleWeb.ErrorReportControllerTest do
|
||||||
use PlausibleWeb.ConnCase, async: true
|
use PlausibleWeb.ConnCase, async: true
|
||||||
@moduletag :full_build_only
|
@moduletag :ee_only
|
||||||
|
|
||||||
use Bamboo.Test
|
use Bamboo.Test
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ defmodule PlausibleWeb.Site.InvitationControllerTest do
|
||||||
assert new_owner_membership.role == :owner
|
assert new_owner_membership.role == :owner
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "fails when new owner has no plan", %{conn: conn, user: user} do
|
test "fails when new owner has no plan", %{conn: conn, user: user} do
|
||||||
old_owner = insert(:user)
|
old_owner = insert(:user)
|
||||||
site = insert(:site, members: [old_owner])
|
site = insert(:site, members: [old_owner])
|
||||||
|
|
@ -101,7 +101,7 @@ defmodule PlausibleWeb.Site.InvitationControllerTest do
|
||||||
"No existing subscription"
|
"No existing subscription"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "fails when new owner's plan is unsuitable", %{conn: conn, user: user} do
|
test "fails when new owner's plan is unsuitable", %{conn: conn, user: user} do
|
||||||
old_owner = insert(:user)
|
old_owner = insert(:user)
|
||||||
site = insert(:site, members: [old_owner])
|
site = insert(:site, members: [old_owner])
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ defmodule PlausibleWeb.Site.MembershipControllerTest do
|
||||||
refute element_exists?(html, ~s/button[type=submit][disabled]/)
|
refute element_exists?(html, ~s/button[type=submit][disabled]/)
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "display a notice when is over limit", %{conn: conn, user: user} do
|
test "display a notice when is over limit", %{conn: conn, user: user} do
|
||||||
memberships = [
|
memberships = [
|
||||||
build(:site_membership, user: user, role: :owner) | build_list(5, :site_membership)
|
build(:site_membership, user: user, role: :owner) | build_list(5, :site_membership)
|
||||||
|
|
@ -54,7 +54,7 @@ defmodule PlausibleWeb.Site.MembershipControllerTest do
|
||||||
assert redirected_to(conn) == "/#{URI.encode_www_form(site.domain)}/settings/people"
|
assert redirected_to(conn) == "/#{URI.encode_www_form(site.domain)}/settings/people"
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "fails to create invitation when is over limit", %{conn: conn, user: user} do
|
test "fails to create invitation when is over limit", %{conn: conn, user: user} do
|
||||||
memberships = [
|
memberships = [
|
||||||
build(:site_membership, user: user, role: :owner) | build_list(5, :site_membership)
|
build(:site_membership, user: user, role: :owner) | build_list(5, :site_membership)
|
||||||
|
|
|
||||||
|
|
@ -305,7 +305,7 @@ defmodule PlausibleWeb.SiteControllerTest do
|
||||||
assert_no_emails_delivered()
|
assert_no_emails_delivered()
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag :full_build_only
|
@tag :ee_only
|
||||||
test "does not allow site creation when the user is at their site limit", %{
|
test "does not allow site creation when the user is at their site limit", %{
|
||||||
conn: conn,
|
conn: conn,
|
||||||
user: user
|
user: user
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue