mirror of
https://github.com/plausible/analytics.git
synced 2024-08-16 13:20:59 +03:00
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-to: type=gha,mode=max
|
||||
build-args: |
|
||||
MIX_ENV=small
|
||||
MIX_ENV=ce
|
||||
BUILD_METADATA=${{ steps.meta.outputs.json }}
|
||||
ERL_FLAGS=+JPperf true
|
||||
|
||||
|
2
.github/workflows/build-public-images.yml
vendored
2
.github/workflows/build-public-images.yml
vendored
@ -46,7 +46,7 @@ jobs:
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
build-args: |
|
||||
MIX_ENV=small
|
||||
MIX_ENV=ce
|
||||
BUILD_METADATA=${{ steps.meta.outputs.json }}
|
||||
ERL_FLAGS=+JMsingle true
|
||||
|
||||
|
4
.github/workflows/elixir.yml
vendored
4
.github/workflows/elixir.yml
vendored
@ -19,7 +19,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
mix_env: ["test", "small_test"]
|
||||
mix_env: ["test", "ce_test"]
|
||||
postgres_image: ["postgres:16"]
|
||||
test_experimental_reduced_joins: ["0"]
|
||||
|
||||
@ -113,7 +113,7 @@ jobs:
|
||||
MINIO_HOST_FOR_CLICKHOUSE: "172.17.0.1"
|
||||
|
||||
- run: mix test --include slow --max-failures 1 --warnings-as-errors
|
||||
if: env.MIX_ENV == 'small_test'
|
||||
if: env.MIX_ENV == 'ce_test'
|
||||
|
||||
static:
|
||||
name: Static checks (format, credo, dialyzer)
|
||||
|
@ -4,7 +4,7 @@
|
||||
#### Builder
|
||||
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
|
||||
ENV MIX_ENV=$MIX_ENV
|
||||
@ -60,7 +60,7 @@ LABEL maintainer="plausible.io <hello@plausible.io>"
|
||||
ARG BUILD_METADATA={}
|
||||
ENV BUILD_METADATA=$BUILD_METADATA
|
||||
ENV LANG=C.UTF-8
|
||||
ARG MIX_ENV=small
|
||||
ARG MIX_ENV=ce
|
||||
ENV MIX_ENV=$MIX_ENV
|
||||
|
||||
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()}"])
|
||||
end
|
||||
|
||||
if config_env() == :small_dev do
|
||||
if config_env() == :ce_dev do
|
||||
Envy.load(["config/.env.dev"])
|
||||
end
|
||||
|
||||
if config_env() == :small_test do
|
||||
if config_env() == :ce_test do
|
||||
Envy.load(["config/.env.test"])
|
||||
end
|
||||
|
||||
|
@ -3,7 +3,7 @@ defmodule Plausible do
|
||||
Build-related macros
|
||||
"""
|
||||
|
||||
@small_builds [:small, :small_test, :small_dev]
|
||||
@ce_builds [:ce, :ce_test, :ce_dev]
|
||||
|
||||
defmacro __using__(_) do
|
||||
quote do
|
||||
@ -12,16 +12,42 @@ defmodule Plausible do
|
||||
end
|
||||
end
|
||||
|
||||
defmacro on_full_build(clauses) do
|
||||
do_on_full_build(clauses)
|
||||
defmacro on_ee(clauses) do
|
||||
do_on_ee(clauses)
|
||||
end
|
||||
|
||||
def do_on_full_build(do: block) do
|
||||
do_on_full_build(do: block, else: nil)
|
||||
defmacro on_ce(clauses) do
|
||||
do_on_ce(clauses)
|
||||
end
|
||||
|
||||
def do_on_full_build(do: do_block, else: else_block) do
|
||||
if Mix.env() not in @small_builds do
|
||||
defmacro ee?() 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
|
||||
unquote(do_block)
|
||||
end
|
||||
@ -31,22 +57,4 @@ defmodule Plausible do
|
||||
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
|
||||
|
@ -7,7 +7,7 @@ defmodule Plausible.Application do
|
||||
require Logger
|
||||
|
||||
def start(_type, _args) do
|
||||
on_full_build(do: Plausible.License.ensure_valid_license())
|
||||
on_ee(do: Plausible.License.ensure_valid_license())
|
||||
|
||||
children = [
|
||||
Plausible.Cache.Stats,
|
||||
|
@ -57,7 +57,7 @@ defmodule Plausible.Auth do
|
||||
)
|
||||
end
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
def is_super_admin?(nil), do: false
|
||||
def is_super_admin?(%Plausible.Auth.User{id: id}), do: is_super_admin?(id)
|
||||
|
||||
|
@ -252,7 +252,7 @@ defmodule Plausible.Auth.User do
|
||||
end
|
||||
|
||||
defp trial_expiry() do
|
||||
on_full_build do
|
||||
on_ee do
|
||||
Timex.today() |> Timex.shift(days: 30)
|
||||
else
|
||||
Timex.today() |> Timex.shift(years: 100)
|
||||
@ -260,7 +260,7 @@ defmodule Plausible.Auth.User do
|
||||
end
|
||||
|
||||
defp set_email_verification_status(user) do
|
||||
on_full_build do
|
||||
on_ee do
|
||||
change(user, email_verified: false)
|
||||
else
|
||||
selfhosted_config = Application.get_env(:plausible, :selfhost)
|
||||
|
@ -134,7 +134,7 @@ defmodule Plausible.Auth.UserAdmin do
|
||||
end
|
||||
end
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
defp usage_link(user) do
|
||||
path = PlausibleWeb.Router.Helpers.admin_path(PlausibleWeb.Endpoint, :usage, user.id)
|
||||
{:safe, ~s(<a href="#{path}">Usage</a>)}
|
||||
|
@ -45,7 +45,7 @@ defmodule Plausible.Billing.Quota do
|
||||
end
|
||||
end
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
@limit_sites_since ~D[2021-05-05]
|
||||
@site_limit_for_trials 10
|
||||
@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
|
||||
|
||||
queries =
|
||||
on_full_build do
|
||||
on_ee do
|
||||
funnels_usage_query =
|
||||
from f in "funnels",
|
||||
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 != []
|
||||
|
||||
funnels_exist =
|
||||
on_full_build do
|
||||
on_ee do
|
||||
Plausible.Repo.exists?(from f in Plausible.Funnel, where: f.site_id == ^site.id)
|
||||
else
|
||||
false
|
||||
|
@ -254,7 +254,7 @@ defmodule Plausible.Exports do
|
||||
}
|
||||
end
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
defp sampled(table, date_range) do
|
||||
from(table)
|
||||
|> Plausible.Stats.Sampling.add_query_hint()
|
||||
|
@ -9,7 +9,7 @@ defmodule Plausible.Goal do
|
||||
field :event_name, :string
|
||||
field :page_path, :string
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
field :currency, Ecto.Enum, values: Money.Currency.known_current_currencies()
|
||||
many_to_many :funnels, Plausible.Funnel, join_through: Plausible.Funnel.Step
|
||||
else
|
||||
@ -22,7 +22,7 @@ defmodule Plausible.Goal do
|
||||
timestamps()
|
||||
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
|
||||
goal
|
||||
@ -77,7 +77,7 @@ defmodule Plausible.Goal do
|
||||
end
|
||||
|
||||
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)
|
||||
else
|
||||
changeset
|
||||
|
@ -22,7 +22,7 @@ defmodule Plausible.Goals do
|
||||
Repo.transaction(fn ->
|
||||
case insert_goal(site, params, upsert?) do
|
||||
{:ok, :insert, goal} ->
|
||||
on_full_build do
|
||||
on_ee do
|
||||
now = Keyword.get(opts, :now, DateTime.utc_now())
|
||||
# credo:disable-for-next-line Credo.Check.Refactor.Nesting
|
||||
if Plausible.Goal.Revenue.revenue?(goal) do
|
||||
@ -103,7 +103,7 @@ defmodule Plausible.Goals do
|
||||
order_by: [desc: g.id],
|
||||
preload: [:site]
|
||||
|
||||
if opts[:preload_funnels?] == true and full_build?() do
|
||||
if opts[:preload_funnels?] == true and ee?() do
|
||||
from(g in query,
|
||||
left_join: assoc(g, :funnels),
|
||||
group_by: g.id,
|
||||
@ -136,7 +136,7 @@ defmodule Plausible.Goals do
|
||||
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 =
|
||||
Multi.new()
|
||||
|
@ -292,7 +292,7 @@ defmodule Plausible.Ingestion.Event do
|
||||
defp put_props(%__MODULE__{} = event), do: event
|
||||
|
||||
defp put_revenue(event) do
|
||||
on_full_build do
|
||||
on_ee do
|
||||
attrs = Plausible.Ingestion.Event.Revenue.get_revenue_attrs(event)
|
||||
update_event_attrs(event, attrs)
|
||||
else
|
||||
|
@ -42,7 +42,7 @@ defmodule Plausible.Ingestion.Request do
|
||||
field :pathname, :string
|
||||
field :props, :map
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
field :revenue_source, :map
|
||||
end
|
||||
|
||||
@ -95,7 +95,7 @@ defmodule Plausible.Ingestion.Request do
|
||||
end
|
||||
end
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
defp put_revenue_source(changeset, request_body) do
|
||||
Plausible.Ingestion.Request.Revenue.put_revenue_source(changeset, request_body)
|
||||
end
|
||||
|
@ -64,7 +64,7 @@ defmodule Plausible.Plugins.API.Token do
|
||||
can scan repositories for accidental secret commits.
|
||||
"""
|
||||
def prefix() do
|
||||
on_full_build do
|
||||
on_ee do
|
||||
env = Application.get_env(:plausible, :environment)
|
||||
|
||||
case env do
|
||||
|
@ -58,7 +58,7 @@ defmodule Plausible.S3 do
|
||||
|
||||
# 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
|
||||
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
|
||||
[s3_url, _] = String.split(presigned_url, "?")
|
||||
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)
|
||||
|> Multi.insert_or_update(:membership, membership)
|
||||
|> Multi.run(:update_locked_sites, fn _, _ ->
|
||||
on_full_build do
|
||||
on_ee do
|
||||
# At this point this function should be guaranteed to unlock
|
||||
# the site, via `Invitations.ensure_can_take_ownership/2`.
|
||||
:unlocked = Billing.SiteLocker.update_sites_for(user, send_email?: false)
|
||||
|
@ -64,7 +64,7 @@ defmodule Plausible.Site.Memberships.Invitations do
|
||||
:ok
|
||||
end
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
@spec ensure_can_take_ownership(Site.t(), Auth.User.t()) ::
|
||||
:ok | {:error, Quota.over_limits_error() | :no_plan}
|
||||
def ensure_can_take_ownership(site, new_owner) do
|
||||
|
@ -31,7 +31,7 @@ defmodule Plausible.Stats do
|
||||
CurrentVisitors.current_visitors(site)
|
||||
end
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
def funnel(site, query, funnel) do
|
||||
include_sentry_replay_info()
|
||||
Plausible.Stats.Funnel.funnel(site, query, funnel)
|
||||
|
@ -7,7 +7,7 @@ defmodule Plausible.Stats.Aggregate do
|
||||
|
||||
def aggregate(site, query, metrics) do
|
||||
{currency, metrics} =
|
||||
on_full_build do
|
||||
on_ee do
|
||||
Plausible.Stats.Goal.Revenue.get_revenue_tracking_currency(site, query, metrics)
|
||||
else
|
||||
{nil, metrics}
|
||||
@ -200,7 +200,7 @@ defmodule Plausible.Stats.Aggregate do
|
||||
|
||||
defp maybe_round_value(entry), do: entry
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
defp cast_revenue_metrics_to_money(results, revenue_goals) do
|
||||
Plausible.Stats.Goal.Revenue.cast_revenue_metrics_to_money(results, revenue_goals)
|
||||
end
|
||||
|
@ -48,7 +48,7 @@ defmodule Plausible.Stats.Base do
|
||||
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)
|
||||
end
|
||||
|
||||
@ -142,7 +142,7 @@ defmodule Plausible.Stats.Base do
|
||||
from s in q, where: s.start >= ^first_datetime and s.start < ^last_datetime
|
||||
end
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
sessions_q = Plausible.Stats.Sampling.add_query_hint(sessions_q, query)
|
||||
end
|
||||
|
||||
@ -254,7 +254,7 @@ defmodule Plausible.Stats.Base do
|
||||
}
|
||||
end
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
defp select_event_metric(:total_revenue) do
|
||||
%{total_revenue: Plausible.Stats.Goal.Revenue.total_revenue_query()}
|
||||
end
|
||||
|
@ -13,7 +13,7 @@ defmodule Plausible.Stats.Breakdown do
|
||||
|
||||
@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
|
||||
|
||||
@ -38,7 +38,7 @@ defmodule Plausible.Stats.Breakdown do
|
||||
no_revenue = {nil, metrics -- @revenue_metrics}
|
||||
|
||||
{revenue_goals, metrics} =
|
||||
on_full_build do
|
||||
on_ee do
|
||||
if Plausible.Billing.Feature.RevenueGoals.enabled?(site) do
|
||||
revenue_goals = Enum.filter(event_goals, &Plausible.Goal.Revenue.revenue?/1)
|
||||
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
|
||||
{currency, metrics} =
|
||||
on_full_build do
|
||||
on_ee do
|
||||
Plausible.Stats.Goal.Revenue.get_revenue_tracking_currency(site, query, metrics)
|
||||
else
|
||||
{nil, metrics}
|
||||
@ -758,7 +758,7 @@ defmodule Plausible.Stats.Breakdown do
|
||||
])
|
||||
end
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
defp cast_revenue_metrics_to_money(results, revenue_goals) do
|
||||
Plausible.Stats.Goal.Revenue.cast_revenue_metrics_to_money(results, revenue_goals)
|
||||
end
|
||||
|
@ -113,7 +113,7 @@ defmodule Plausible.Stats.Clickhouse do
|
||||
offset: ^offset
|
||||
)
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
referrers = Plausible.Stats.Sampling.add_query_hint(referrers, 10_000_000)
|
||||
end
|
||||
|
||||
@ -193,7 +193,7 @@ defmodule Plausible.Stats.Clickhouse do
|
||||
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)
|
||||
end
|
||||
|
||||
@ -231,7 +231,7 @@ defmodule Plausible.Stats.Clickhouse do
|
||||
},
|
||||
group_by: [e.site_id]
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
query = Plausible.Stats.Sampling.add_query_hint(query)
|
||||
end
|
||||
|
||||
@ -260,7 +260,7 @@ defmodule Plausible.Stats.Clickhouse do
|
||||
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)
|
||||
end
|
||||
|
||||
|
@ -17,7 +17,7 @@ defmodule Plausible.Stats.Metrics do
|
||||
:events,
|
||||
:conversion_rate,
|
||||
: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)
|
||||
|
||||
|
@ -31,7 +31,7 @@ defmodule Plausible.Stats.Query do
|
||||
|> put_imported_opts(site, params)
|
||||
|> maybe_drop_prop_filter(site)
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
query = Plausible.Stats.Sampling.put_threshold(query, params)
|
||||
end
|
||||
|
||||
|
@ -25,7 +25,7 @@ defmodule Plausible.Stats.Timeseries do
|
||||
Plausible.Stats.TableDecider.partition_metrics(metrics, query)
|
||||
|
||||
{currency, event_metrics} =
|
||||
on_full_build do
|
||||
on_ee do
|
||||
Plausible.Stats.Goal.Revenue.get_revenue_tracking_currency(site, query, event_metrics)
|
||||
else
|
||||
{nil, event_metrics}
|
||||
@ -245,7 +245,7 @@ defmodule Plausible.Stats.Timeseries do
|
||||
end)
|
||||
end
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
defp cast_revenue_metrics_to_money(results, revenue_goals) do
|
||||
Plausible.Stats.Goal.Revenue.cast_revenue_metrics_to_money(results, revenue_goals)
|
||||
end
|
||||
|
@ -12,7 +12,7 @@ defmodule Plausible.Users do
|
||||
alias Plausible.Repo
|
||||
|
||||
@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?(user) do
|
||||
@ -36,7 +36,7 @@ defmodule Plausible.Users do
|
||||
end
|
||||
|
||||
@spec accept_traffic_until(Auth.User.t()) :: Date.t()
|
||||
on_full_build do
|
||||
on_ee do
|
||||
def accept_traffic_until(user) do
|
||||
user = with_subscription(user)
|
||||
|
||||
|
@ -12,7 +12,7 @@ defmodule Plausible.Release do
|
||||
]
|
||||
|
||||
def should_be_first_launch? do
|
||||
on_full_build do
|
||||
on_ee do
|
||||
false
|
||||
else
|
||||
not (_has_users? = Repo.exists?(Plausible.Auth.User))
|
||||
|
@ -10,7 +10,7 @@ defmodule PlausibleWeb.Api.StatsController do
|
||||
|
||||
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)
|
||||
|
||||
@ -347,13 +347,13 @@ defmodule PlausibleWeb.Api.StatsController do
|
||||
top_stats_entry(results, comparison, "Unique visitors", :total_visitors),
|
||||
top_stats_entry(results, comparison, "Unique conversions", :visitors, 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,
|
||||
formatter: &format_money/1,
|
||||
graphable?: true
|
||||
)
|
||||
end,
|
||||
on_full_build do
|
||||
on_ee do
|
||||
top_stats_entry(results, comparison, "Total revenue", :total_revenue,
|
||||
formatter: &format_money/1,
|
||||
graphable?: true
|
||||
@ -480,7 +480,7 @@ defmodule PlausibleWeb.Api.StatsController do
|
||||
end
|
||||
end
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
def funnel(conn, %{"id" => funnel_id} = params) do
|
||||
site = Plausible.Repo.preload(conn.assigns.site, :owner)
|
||||
|
||||
@ -1377,7 +1377,7 @@ defmodule PlausibleWeb.Api.StatsController do
|
||||
end
|
||||
end
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
defdelegate format_revenue_metric(metric_value), to: PlausibleWeb.Controllers.API.Revenue
|
||||
defdelegate format_money(money), to: PlausibleWeb.Controllers.API.Revenue
|
||||
else
|
||||
|
@ -679,7 +679,7 @@ defmodule PlausibleWeb.SiteController do
|
||||
|> redirect(external: Routes.site_path(conn, :settings_integrations, site.domain))
|
||||
end
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
# exported archives are downloaded from object storage
|
||||
else
|
||||
alias Plausible.Exports
|
||||
|
@ -89,7 +89,7 @@ defmodule PlausibleWeb.StatsController do
|
||||
end
|
||||
end
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
defp list_funnels(site) do
|
||||
Plausible.Funnels.list(site)
|
||||
end
|
||||
@ -356,7 +356,7 @@ defmodule PlausibleWeb.StatsController do
|
||||
defp get_flags(_user, _site), do: %{}
|
||||
|
||||
defp is_dbip() do
|
||||
on_full_build do
|
||||
on_ee do
|
||||
false
|
||||
else
|
||||
Plausible.Geo.database_type()
|
||||
|
@ -349,7 +349,7 @@ defmodule PlausibleWeb.Email do
|
||||
|
||||
def export_success(user, site, download_url, expires_at) do
|
||||
subject =
|
||||
on_full_build do
|
||||
on_ee do
|
||||
"Your Plausible Analytics export is now ready for download"
|
||||
else
|
||||
"Your export is now ready for download"
|
||||
@ -377,7 +377,7 @@ defmodule PlausibleWeb.Email do
|
||||
|
||||
def export_failure(user, site) do
|
||||
subject =
|
||||
on_full_build do
|
||||
on_ee do
|
||||
"Your Plausible Analytics export has failed"
|
||||
else
|
||||
"Your export has failed"
|
||||
|
@ -36,7 +36,7 @@ defmodule PlausibleWeb.Endpoint do
|
||||
static_paths = ~w(css js images favicon.ico)
|
||||
|
||||
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
|
||||
static_paths
|
||||
else
|
||||
@ -50,7 +50,7 @@ defmodule PlausibleWeb.Endpoint do
|
||||
only: static_paths
|
||||
)
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
plug(Plug.Static,
|
||||
at: "/kaffy",
|
||||
from: :kaffy,
|
||||
|
@ -149,7 +149,7 @@ defmodule PlausibleWeb.Live.GoalSettings.Form do
|
||||
</div>
|
||||
|
||||
<div
|
||||
:if={full_build?()}
|
||||
:if={ee?()}
|
||||
class="mt-6 space-y-3"
|
||||
x-data={
|
||||
Jason.encode!(%{
|
||||
@ -211,7 +211,7 @@ defmodule PlausibleWeb.Live.GoalSettings.Form do
|
||||
submit_name={@f[:currency].name}
|
||||
module={ComboBox}
|
||||
suggest_fun={
|
||||
on_full_build do
|
||||
on_ee do
|
||||
fn
|
||||
"", [] ->
|
||||
Plausible.Goal.Revenue.currency_options()
|
||||
|
@ -64,7 +64,7 @@ defmodule PlausibleWeb.Live.RegisterForm do
|
||||
~H"""
|
||||
<div class="mx-auto mt-6 text-center dark:text-gray-300">
|
||||
<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
|
||||
<% else %>
|
||||
Register your 30-day free trial
|
||||
@ -158,7 +158,7 @@ defmodule PlausibleWeb.Live.RegisterForm do
|
||||
<% end %>
|
||||
|
||||
<% submit_text =
|
||||
if small_build?() or @invitation do
|
||||
if ce?() or @invitation do
|
||||
"Create my account →"
|
||||
else
|
||||
"Start my free trial →"
|
||||
@ -301,7 +301,7 @@ defmodule PlausibleWeb.Live.RegisterForm do
|
||||
defp add_user(socket, user) do
|
||||
case Repo.insert(user) do
|
||||
{:ok, _user} ->
|
||||
on_full_build do
|
||||
on_ee do
|
||||
metrics_params =
|
||||
if socket.assigns.invitation do
|
||||
%{
|
||||
|
@ -682,7 +682,7 @@ defmodule PlausibleWeb.Live.Sites do
|
||||
defp check_limits(invitation, _), do: %{invitation: invitation}
|
||||
|
||||
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 ->
|
||||
%{invitation: invitation}
|
||||
|
||||
|
@ -10,7 +10,7 @@ defmodule PlausibleWeb.Router do
|
||||
plug :fetch_live_flash
|
||||
plug :put_secure_browser_headers
|
||||
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.AuthPlug
|
||||
plug PlausibleWeb.LastSeenPlug
|
||||
@ -51,7 +51,7 @@ defmodule PlausibleWeb.Router do
|
||||
plug :accepts, ["json"]
|
||||
end
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
pipeline :flags do
|
||||
plug :accepts, ["html"]
|
||||
plug :put_secure_browser_headers
|
||||
@ -62,24 +62,24 @@ defmodule PlausibleWeb.Router do
|
||||
end
|
||||
end
|
||||
|
||||
if Mix.env() in [:dev, :small_dev] do
|
||||
if Mix.env() in [:dev, :ce_dev] do
|
||||
forward "/sent-emails", Bamboo.SentEmailViewerPlug
|
||||
end
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
use Kaffy.Routes,
|
||||
scope: "/crm",
|
||||
pipe_through: [PlausibleWeb.Plugs.NoRobots, PlausibleWeb.CRMAuthPlug]
|
||||
end
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
scope "/crm", PlausibleWeb do
|
||||
pipe_through :flags
|
||||
get "/auth/user/:user_id/usage", AdminController, :usage
|
||||
end
|
||||
end
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
scope path: "/flags" do
|
||||
pipe_through :flags
|
||||
forward "/", FunWithFlags.UI.Router, namespace: "flags"
|
||||
@ -129,7 +129,7 @@ defmodule PlausibleWeb.Router do
|
||||
scope "/api/stats", PlausibleWeb.Api do
|
||||
pipe_through :internal_stats_api
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
get "/:domain/funnels/:id", StatsController, :funnel
|
||||
end
|
||||
|
||||
@ -168,7 +168,7 @@ defmodule PlausibleWeb.Router do
|
||||
get "/timeseries", ExternalStatsController, :timeseries
|
||||
end
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
scope "/api/v1/sites", PlausibleWeb.Api do
|
||||
pipe_through [:public_api, PlausibleWeb.AuthorizeSitesApiPlug]
|
||||
|
||||
@ -352,7 +352,7 @@ defmodule PlausibleWeb.Router do
|
||||
get "/:website/settings/goals", SiteController, :settings_goals
|
||||
get "/:website/settings/properties", SiteController, :settings_props
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
get "/:website/settings/funnels", SiteController, :settings_funnels
|
||||
end
|
||||
|
||||
@ -391,7 +391,7 @@ defmodule PlausibleWeb.Router do
|
||||
delete "/:website/settings/forget-imported", SiteController, :forget_imported
|
||||
delete "/:website/settings/forget-import/:import_id", SiteController, :forget_import
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
# exported archives are downloaded from object storage
|
||||
else
|
||||
get "/:website/exported-archive", SiteController, :download_local_export
|
||||
|
@ -45,7 +45,7 @@
|
||||
method: :post
|
||||
) %> to <%= @conn.assigns[:current_user].email %>
|
||||
</li>
|
||||
<%= if full_build?() do %>
|
||||
<%= if ee?() do %>
|
||||
<li>
|
||||
<a class="underline text-indigo-600" href="https://plausible.io/contact">
|
||||
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.
|
||||
</div>
|
||||
<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
|
||||
href="https://github.com/plausible/analytics/discussions"
|
||||
class="text-indigo-500"
|
||||
>community-supported forum</a>.
|
||||
</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
|
||||
href="https://plausible.io/contact"
|
||||
class="text-indigo-500"
|
||||
|
@ -1,5 +1,5 @@
|
||||
<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="flex flex-wrap justify-between">
|
||||
<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
|
||||
</a>
|
||||
<%= if full_build?() do %>
|
||||
<%= if ee?() do %>
|
||||
<br /> Lost your recovery codes?
|
||||
<a href="https://plausible.io/contact" class="underline text-indigo-600">
|
||||
Contact us
|
||||
|
@ -46,7 +46,7 @@
|
||||
<a href={Routes.auth_path(@conn, :verify_2fa)} class="underline text-indigo-600">
|
||||
Enter verification code
|
||||
</a>
|
||||
<%= if full_build?() do %>
|
||||
<%= if ee?() do %>
|
||||
<br /> Lost your recovery codes?
|
||||
<a href="https://plausible.io/contact" class="underline text-indigo-600">
|
||||
Contact us
|
||||
|
@ -7,7 +7,7 @@
|
||||
<% else %>
|
||||
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.
|
||||
<%= if full_build?() do %>
|
||||
<%= if ee?() do %>
|
||||
<br /> <br />
|
||||
Please reply to this email to let us know if you're still experiencing issues with the import.
|
||||
<% 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.
|
||||
<br/><br/>
|
||||
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.
|
||||
<%= 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!
|
||||
<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.
|
||||
<%= if full_build?() do %>
|
||||
<%= if ee?() do %>
|
||||
<br /> <br />
|
||||
Please reply to this email to let us know if you're still experiencing issues with the import.
|
||||
<% end %>
|
||||
|
@ -22,14 +22,14 @@
|
||||
<div class="ml-3">
|
||||
<h3 class="text-sm font-medium text-yellow-800 dark:text-yellow-400">
|
||||
There has been a server error.
|
||||
<%= if full_build?() do %>
|
||||
<%= if ee?() do %>
|
||||
But don't worry, we're on it!
|
||||
<% end %>
|
||||
</h3>
|
||||
|
||||
<div class="mt-2 text-sm text-yellow-700 dark:text-yellow-300">
|
||||
<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.
|
||||
<% else %>
|
||||
We have been notified.
|
||||
@ -40,7 +40,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= if full_build?() do %>
|
||||
<%= if ee?() do %>
|
||||
<%= if assigns[:trace_id] do %>
|
||||
<div class="my-6">
|
||||
<%= form_for :error, Routes.error_report_path(PlausibleWeb.Endpoint, :submit_error_report), fn f -> %>
|
||||
|
@ -14,12 +14,12 @@
|
||||
) %>
|
||||
</h4>
|
||||
<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 />
|
||||
Solely funded by our subscribers.
|
||||
<% 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
|
||||
<.styled_link href="https://plausible.io">
|
||||
plausible.io
|
||||
|
@ -28,7 +28,7 @@
|
||||
<% @conn.assigns[:current_user] -> %>
|
||||
<ul class="flex items-center w-full sm:w-auto">
|
||||
<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"
|
||||
>
|
||||
<%= link(trial_notificaton(@conn.assigns[:current_user]),
|
||||
@ -61,7 +61,7 @@
|
||||
<.dropdown_link new_tab href="https://plausible.io/docs">
|
||||
Help Center
|
||||
</.dropdown_link>
|
||||
<%= if full_build?() do %>
|
||||
<%= if ee?() do %>
|
||||
<.dropdown_link new_tab href="https://plausible.io/contact">
|
||||
Contact Support
|
||||
</.dropdown_link>
|
||||
@ -80,7 +80,7 @@
|
||||
</:panel>
|
||||
</.dropdown>
|
||||
</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>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<%= on_full_build do %>
|
||||
<%= on_ee do %>
|
||||
<%= if !@conn.assigns[:skip_plausible_tracking] do %>
|
||||
<script
|
||||
defer
|
||||
|
@ -4,7 +4,7 @@
|
||||
<%= @inner_content %>
|
||||
<br /><br />
|
||||
|
||||
<%= if full_build?() do %>Regards,<br />
|
||||
<%= if ee?() do %>Regards,<br />
|
||||
The Plausible Team 💌
|
||||
<br /><br /><% end %>
|
||||
|
||||
@ -12,4 +12,4 @@ The Plausible Team 💌
|
||||
<br /><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 %>
|
||||
<br /><br />
|
||||
|
||||
<%= if full_build?() do %>Regards,<br />
|
||||
<%= if ee?() do %>Regards,<br />
|
||||
The Plausible Team 💌
|
||||
<br /><br /><% end %>
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
session: %{
|
||||
"site_id" => @site.id,
|
||||
"current_user_id" => @current_user.id,
|
||||
"storage" => on_full_build(do: "s3", else: "local")
|
||||
"storage" => on_ee(do: "s3", else: "local")
|
||||
}
|
||||
) %>
|
||||
</div>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<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.
|
||||
</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
|
||||
href={Routes.site_path(@conn, :settings_funnels, @site.domain)}
|
||||
class="text-indigo-500 underline"
|
||||
|
@ -35,7 +35,7 @@
|
||||
session: %{
|
||||
"site_id" => @site.id,
|
||||
"email_to" => @current_user.email,
|
||||
"storage" => on_full_build(do: "s3", else: "local")
|
||||
"storage" => on_ee(do: "s3", else: "local")
|
||||
}
|
||||
) %>
|
||||
</div>
|
||||
|
@ -42,14 +42,14 @@
|
||||
</.styled_link>
|
||||
|
||||
<br />
|
||||
<span :if={full_build?()}>
|
||||
<span :if={ee?()}>
|
||||
Check the
|
||||
<.styled_link href={Routes.site_path(@conn, :settings_general, @site.domain)}>
|
||||
site settings
|
||||
</.styled_link>
|
||||
to invite team members, <br /> import historical stats and more.
|
||||
</span>
|
||||
<span :if={small_build?()}>
|
||||
<span :if={ce?()}>
|
||||
Still not working? Ask on our
|
||||
<.styled_link new_tab href="https://github.com/plausible/analytics/discussions">
|
||||
community-supported forum
|
||||
|
@ -4,7 +4,7 @@ defmodule PlausibleWeb.ErrorView do
|
||||
|
||||
def render("500.json", %{conn: %{assigns: %{plugins_api: true}}}) do
|
||||
contact_support_note =
|
||||
on_full_build do
|
||||
on_ee do
|
||||
"If the problem persists please contact support@plausible.io"
|
||||
end
|
||||
|
||||
|
@ -41,7 +41,7 @@ defmodule PlausibleWeb.LayoutView do
|
||||
end
|
||||
|
||||
def logo_path(filename) do
|
||||
if full_build?() do
|
||||
if ee?() do
|
||||
Path.join("/images/ee/", filename)
|
||||
else
|
||||
Path.join("/images/ce/", filename)
|
||||
@ -61,7 +61,7 @@ defmodule PlausibleWeb.LayoutView do
|
||||
%{key: "People", value: "people", icon: :users},
|
||||
%{key: "Visibility", value: "visibility", icon: :eye},
|
||||
%{key: "Goals", value: "goals", icon: :check_circle},
|
||||
on_full_build do
|
||||
on_ee do
|
||||
%{key: "Funnels", value: "funnels", icon: :funnel}
|
||||
end,
|
||||
%{key: "Custom Properties", value: "properties", icon: :document_text},
|
||||
|
@ -30,7 +30,7 @@ defmodule Plausible.Workers.ClickhouseCleanSites do
|
||||
"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
|
||||
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"),
|
||||
elixir: "~> 1.14",
|
||||
elixirc_paths: elixirc_paths(Mix.env()),
|
||||
start_permanent: Mix.env() in [:prod, :small],
|
||||
start_permanent: Mix.env() in [:prod, :ce],
|
||||
aliases: aliases(),
|
||||
deps: deps(),
|
||||
test_coverage: [
|
||||
@ -51,10 +51,10 @@ defmodule Plausible.MixProject do
|
||||
defp elixirc_paths(env) when env in [:test, :dev],
|
||||
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"]
|
||||
|
||||
defp elixirc_paths(:small), do: ["lib"]
|
||||
defp elixirc_paths(:ce), do: ["lib"]
|
||||
defp elixirc_paths(_), do: ["lib", "extra/lib"]
|
||||
|
||||
# Specifies your project dependencies.
|
||||
@ -68,7 +68,7 @@ defmodule Plausible.MixProject do
|
||||
{:bamboo_smtp, "~> 4.1"},
|
||||
{:bamboo_mua, "~> 0.1.4"},
|
||||
{:bcrypt_elixir, "~> 3.0"},
|
||||
{:bypass, "~> 2.1", only: [:dev, :test, :small_test]},
|
||||
{:bypass, "~> 2.1", only: [:dev, :test, :ce_test]},
|
||||
{:ecto_ch, "~> 0.3"},
|
||||
{:cloak, "~> 1.1"},
|
||||
{:cloak_ecto, "~> 1.2"},
|
||||
@ -77,15 +77,15 @@ defmodule Plausible.MixProject do
|
||||
{:credo, "~> 1.5", only: [:dev, :test], runtime: false},
|
||||
{:csv, "~> 2.3"},
|
||||
{: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_sql, "~> 3.11.0"},
|
||||
{:envy, "~> 1.1.1"},
|
||||
{: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},
|
||||
{: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_ui, "~> 1.0"},
|
||||
{:locus, "~> 2.3"},
|
||||
@ -94,7 +94,7 @@ defmodule Plausible.MixProject do
|
||||
{:jason, "~> 1.3"},
|
||||
{:kaffy, "~> 0.10.2", only: [:dev, :test, :staging, :prod]},
|
||||
{: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"},
|
||||
{:nimble_totp, "~> 1.0"},
|
||||
{:oban, "~> 2.17.0"},
|
||||
@ -109,7 +109,7 @@ defmodule Plausible.MixProject do
|
||||
{:phoenix_view, "~> 2.0"},
|
||||
{:phoenix_ecto, "~> 4.0"},
|
||||
{: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_live_view, "~> 0.18"},
|
||||
{:php_serializer, "~> 2.0"},
|
||||
@ -134,8 +134,8 @@ defmodule Plausible.MixProject do
|
||||
{:joken, "~> 2.5"},
|
||||
{:paginator, git: "https://github.com/duffelhq/paginator.git"},
|
||||
{:scrivener_ecto, "~> 2.0"},
|
||||
{:esbuild, "~> 0.7", runtime: Mix.env() in [:dev, :small_dev]},
|
||||
{:tailwind, "~> 0.2.0", 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, :ce_dev]},
|
||||
{:ex_json_logger, "~> 1.4.0"},
|
||||
{:ecto_network, "~> 1.5.0"},
|
||||
{:ex_aws, "~> 2.5"},
|
||||
|
@ -20,7 +20,7 @@ defmodule Plausible.UsersTest do
|
||||
end
|
||||
|
||||
describe "on_trial?" do
|
||||
@describetag :full_build_only
|
||||
@describetag :ee_only
|
||||
test "is true with >= 0 trial days left" do
|
||||
user = insert(:user)
|
||||
|
||||
@ -41,7 +41,7 @@ defmodule Plausible.UsersTest do
|
||||
end
|
||||
|
||||
describe "update_accept_traffic_until" do
|
||||
@describetag :full_build_only
|
||||
@describetag :ee_only
|
||||
test "update" do
|
||||
user = insert(:user) |> User.start_trial() |> Repo.update!()
|
||||
# 30 for trial + 14
|
||||
|
@ -154,7 +154,7 @@ defmodule Plausible.BillingTest do
|
||||
refute Repo.reload!(site).locked
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "updates accept_traffic_until" do
|
||||
user = insert(:user)
|
||||
|
||||
@ -228,7 +228,7 @@ defmodule Plausible.BillingTest do
|
||||
refute Repo.reload!(site).locked
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "updates accept_traffic_until" do
|
||||
user = insert(:user)
|
||||
subscription = insert(:subscription, user: user)
|
||||
@ -359,7 +359,7 @@ defmodule Plausible.BillingTest do
|
||||
end
|
||||
|
||||
describe "subscription_payment_succeeded" do
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "updates accept_traffic_until" do
|
||||
user = insert(:user)
|
||||
subscription = insert(:subscription, user: user)
|
||||
|
@ -307,7 +307,7 @@ defmodule Plausible.Billing.PlansTest do
|
||||
assert Plans.suggest_tier(user) == :growth
|
||||
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
|
||||
user = insert(:user, inserted_at: ~N[2023-10-25 10:00:00])
|
||||
site = insert(:site, members: [user])
|
||||
|
@ -4,7 +4,7 @@ defmodule Plausible.Billing.QuotaTest do
|
||||
alias Plausible.Billing.{Quota, Plans}
|
||||
alias Plausible.Billing.Feature.{Goals, Props, StatsAPI}
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
alias Plausible.Billing.Feature.Funnels
|
||||
alias Plausible.Billing.Feature.RevenueGoals
|
||||
end
|
||||
@ -17,7 +17,7 @@ defmodule Plausible.Billing.QuotaTest do
|
||||
@v4_1m_plan_id "857101"
|
||||
|
||||
describe "site_limit/1" do
|
||||
@describetag :full_build_only
|
||||
@describetag :ee_only
|
||||
|
||||
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))
|
||||
@ -386,7 +386,7 @@ defmodule Plausible.Billing.QuotaTest do
|
||||
end
|
||||
|
||||
describe "team_member_limit/1" do
|
||||
@describetag :full_build_only
|
||||
@describetag :ee_only
|
||||
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_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)
|
||||
end
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
test "returns [Funnels] when user/site uses funnels" do
|
||||
user = insert(:user)
|
||||
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)
|
||||
end
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
test "returns multiple features" do
|
||||
user = insert(:user)
|
||||
|
||||
@ -522,7 +522,7 @@ defmodule Plausible.Billing.QuotaTest do
|
||||
end
|
||||
|
||||
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
|
||||
user = insert(:user, trial_expiry_date: ~D[2023-01-01])
|
||||
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)
|
||||
end
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
test "returns the enterprise plan features" do
|
||||
user = insert(:user)
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
defmodule Plausible.FunnelsTest do
|
||||
use Plausible.DataCase
|
||||
@moduletag :full_build_only
|
||||
@moduletag :ee_only
|
||||
|
||||
use Plausible
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
alias Plausible.Goals
|
||||
alias Plausible.Funnels
|
||||
alias Plausible.Stats
|
||||
|
@ -48,7 +48,7 @@ defmodule Plausible.GoalsTest do
|
||||
assert {"has already been taken", _} = changeset.errors[:event_name]
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "create/2 sets site.updated_at for revenue goal" do
|
||||
site_1 = insert(:site, updated_at: DateTime.add(DateTime.utc_now(), -3600))
|
||||
|
||||
@ -64,7 +64,7 @@ defmodule Plausible.GoalsTest do
|
||||
:eq
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "create/2 creates revenue goal" do
|
||||
site = insert(:site)
|
||||
{:ok, goal} = Goals.create(site, %{"event_name" => "Purchase", "currency" => "EUR"})
|
||||
@ -73,7 +73,7 @@ defmodule Plausible.GoalsTest do
|
||||
assert goal.currency == :EUR
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "create/2 returns error when site does not have access to revenue goals" do
|
||||
user = insert(:user, subscription: build(:growth_subscription))
|
||||
site = insert(:site, members: [user])
|
||||
@ -82,7 +82,7 @@ defmodule Plausible.GoalsTest do
|
||||
Goals.create(site, %{"event_name" => "Purchase", "currency" => "EUR"})
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "create/2 fails for unknown currency code" do
|
||||
site = insert(:site)
|
||||
|
||||
@ -92,7 +92,7 @@ defmodule Plausible.GoalsTest do
|
||||
assert [currency: {"is invalid", _}] = changeset.errors
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "list_revenue_goals/1 lists event_names and currencies for each revenue goal" do
|
||||
site = insert(:site)
|
||||
|
||||
@ -155,7 +155,7 @@ defmodule Plausible.GoalsTest do
|
||||
assert [] = Goals.for_site(site)
|
||||
end
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
test "goals can be fetched with funnel count preloaded" do
|
||||
site = insert(:site)
|
||||
|
||||
|
@ -6,7 +6,7 @@ defmodule Plausible.Imported.CSVImporterTest do
|
||||
|
||||
doctest CSVImporter, import: true
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
@moduletag :minio
|
||||
end
|
||||
|
||||
@ -33,7 +33,7 @@ defmodule Plausible.Imported.CSVImporterTest do
|
||||
Enum.map(tables, fn table ->
|
||||
filename = "#{table}_#{start_date}_#{end_date}.csv"
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
%{
|
||||
"filename" => filename,
|
||||
"s3_url" =>
|
||||
@ -54,7 +54,7 @@ defmodule Plausible.Imported.CSVImporterTest do
|
||||
start_date: date_range.first,
|
||||
end_date: date_range.last,
|
||||
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} =
|
||||
@ -72,7 +72,7 @@ defmodule Plausible.Imported.CSVImporterTest do
|
||||
|
||||
assert CSVImporter.parse_args(args) == [
|
||||
uploads: uploads,
|
||||
storage: on_full_build(do: "s3", else: "local")
|
||||
storage: on_ee(do: "s3", else: "local")
|
||||
]
|
||||
end
|
||||
end
|
||||
@ -312,7 +312,7 @@ defmodule Plausible.Imported.CSVImporterTest do
|
||||
|
||||
uploads =
|
||||
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)
|
||||
[bucket, key] = String.split(URI.parse(s3_url).path, "/", parts: 2)
|
||||
ExAws.request!(ExAws.S3.put_object(bucket, key, body))
|
||||
@ -331,7 +331,7 @@ defmodule Plausible.Imported.CSVImporterTest do
|
||||
start_date: date_range.first,
|
||||
end_date: date_range.last,
|
||||
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)
|
||||
@ -374,7 +374,7 @@ defmodule Plausible.Imported.CSVImporterTest do
|
||||
|
||||
uploads =
|
||||
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)
|
||||
[bucket, key] = String.split(URI.parse(s3_url).path, "/", parts: 2)
|
||||
ExAws.request!(ExAws.S3.put_object(bucket, key, body))
|
||||
@ -393,7 +393,7 @@ defmodule Plausible.Imported.CSVImporterTest do
|
||||
start_date: date_range.first,
|
||||
end_date: date_range.last,
|
||||
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)
|
||||
@ -479,7 +479,7 @@ defmodule Plausible.Imported.CSVImporterTest do
|
||||
])
|
||||
|
||||
# export archive to s3
|
||||
on_full_build do
|
||||
on_ee do
|
||||
assert {:ok, _job} = Plausible.Exports.schedule_s3_export(site.id, user.email)
|
||||
else
|
||||
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)
|
||||
|
||||
# download archive
|
||||
on_full_build do
|
||||
on_ee do
|
||||
ExAws.request!(
|
||||
ExAws.S3.download_file(
|
||||
Plausible.S3.exports_bucket(),
|
||||
@ -508,7 +508,7 @@ defmodule Plausible.Imported.CSVImporterTest do
|
||||
# upload csvs
|
||||
uploads =
|
||||
Enum.map(files, fn file ->
|
||||
on_full_build do
|
||||
on_ee do
|
||||
%{s3_url: s3_url} = Plausible.S3.import_presign_upload(site.id, file)
|
||||
[bucket, key] = String.split(URI.parse(s3_url).path, "/", parts: 2)
|
||||
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,
|
||||
end_date: date_range.last,
|
||||
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)
|
||||
@ -544,7 +544,7 @@ defmodule Plausible.Imported.CSVImporterTest do
|
||||
end
|
||||
|
||||
defp clean_buckets(_context) do
|
||||
on_full_build do
|
||||
on_ee do
|
||||
clean_bucket = fn bucket ->
|
||||
ExAws.S3.list_objects_v2(bucket)
|
||||
|> ExAws.stream!()
|
||||
|
@ -236,7 +236,7 @@ defmodule Plausible.Ingestion.EventTest do
|
||||
assert dropped.drop_reason == :payment_required
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "saves revenue amount" do
|
||||
site = insert(: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"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "parses revenue source field from a json string" do
|
||||
payload = %{
|
||||
name: "pageview",
|
||||
@ -187,7 +187,7 @@ defmodule Plausible.Ingestion.RequestTest do
|
||||
assert Decimal.new("20.2") == amount
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "sets revenue source with integer amount" do
|
||||
payload = %{
|
||||
name: "pageview",
|
||||
@ -206,7 +206,7 @@ defmodule Plausible.Ingestion.RequestTest do
|
||||
assert Decimal.equal?(amount, Decimal.new("20.0"))
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "sets revenue source with float amount" do
|
||||
payload = %{
|
||||
name: "pageview",
|
||||
@ -225,7 +225,7 @@ defmodule Plausible.Ingestion.RequestTest do
|
||||
assert Decimal.equal?(amount, Decimal.new("20.1"))
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "parses string amounts into money structs" do
|
||||
payload = %{
|
||||
name: "pageview",
|
||||
@ -244,7 +244,7 @@ defmodule Plausible.Ingestion.RequestTest do
|
||||
assert Decimal.equal?(amount, Decimal.new("12.3"))
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "ignores revenue data when currency is invalid" do
|
||||
payload = %{
|
||||
name: "pageview",
|
||||
@ -429,7 +429,7 @@ defmodule Plausible.Ingestion.RequestTest do
|
||||
assert changeset.errors[:request]
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "encodable" do
|
||||
params = %{
|
||||
name: "pageview",
|
||||
|
@ -3,7 +3,7 @@ defmodule Plausible.Plugins.API.TokenTest do
|
||||
|
||||
alias Plausible.Plugins.API.Token
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "basic token properties" do
|
||||
t1 = Token.generate()
|
||||
t2 = Token.generate()
|
||||
@ -25,23 +25,23 @@ defmodule Plausible.Plugins.API.TokenTest do
|
||||
end
|
||||
|
||||
describe "prefix/0" do
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "default prefix - full build" do
|
||||
assert Token.prefix() == "plausible-plugin-test"
|
||||
end
|
||||
|
||||
@tag :small_build_only
|
||||
@tag :ce_build_only
|
||||
test "selfhosted prefix" do
|
||||
assert Token.prefix() == "plausible-plugin-selfhost"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "prod prefix" do
|
||||
patch_env(:environment, "prod")
|
||||
assert Token.prefix() == "plausible-plugin"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "staging prefix" do
|
||||
patch_env(:environment, "staging")
|
||||
assert Token.prefix() == "plausible-plugin-staging"
|
||||
|
@ -4,25 +4,25 @@ defmodule Plausible.ReleaseTest do
|
||||
import ExUnit.CaptureIO
|
||||
|
||||
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
|
||||
refute Repo.exists?(Auth.User)
|
||||
assert Release.should_be_first_launch?()
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "returns false when not self-hosted and has no users" do
|
||||
refute Repo.exists?(Auth.User)
|
||||
refute Release.should_be_first_launch?()
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "returns false when not self-hosted and has users" do
|
||||
insert(:user)
|
||||
refute Release.should_be_first_launch?()
|
||||
end
|
||||
|
||||
@tag :small_build_only
|
||||
@tag :ce_build_only
|
||||
test "returns false when self-hosted and has users" do
|
||||
insert(:user)
|
||||
refute Release.should_be_first_launch?()
|
||||
|
@ -87,7 +87,7 @@ defmodule Plausible.Site.AdminTest do
|
||||
action.(conn, [site], %{"email" => current_owner.email})
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "new owner's plan must accommodate the transferred site", %{
|
||||
conn: conn,
|
||||
transfer_direct_action: action
|
||||
|
@ -51,7 +51,7 @@ defmodule Plausible.Site.CacheTest do
|
||||
refute Cache.get("site3.example.com", cache_name: test, force?: true)
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "cache caches revenue goals", %{test: test} do
|
||||
{:ok, _} =
|
||||
Supervisor.start_link(
|
||||
@ -83,7 +83,7 @@ defmodule Plausible.Site.CacheTest do
|
||||
] = Enum.sort_by(cached_goals, & &1.event_name)
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "cache caches revenue goals with event refresh", %{test: test} do
|
||||
{:ok, _} =
|
||||
Supervisor.start_link(
|
||||
|
@ -32,7 +32,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do
|
||||
assert_no_emails_delivered()
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "unlocks the site if it was previously locked" do
|
||||
site = insert(:site, locked: true, memberships: [])
|
||||
existing_owner = insert(:user)
|
||||
@ -86,7 +86,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do
|
||||
assert Repo.reload!(owner).trial_expiry_date == nil
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "does not allow transferring to an account without an active subscription" do
|
||||
current_owner = insert(:user)
|
||||
site = insert(:site, members: [current_owner])
|
||||
@ -131,7 +131,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do
|
||||
AcceptInvitation.transfer_ownership(site, current_owner)
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "does not allow transferring to and account without suitable plan" do
|
||||
current_owner = insert(:user)
|
||||
site = insert(:site, members: [current_owner])
|
||||
@ -146,7 +146,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do
|
||||
AcceptInvitation.transfer_ownership(site, new_owner)
|
||||
end
|
||||
|
||||
@tag :small_build_only
|
||||
@tag :ce_build_only
|
||||
test "allows transferring to an account without a subscription on self hosted" do
|
||||
current_owner = insert(:user)
|
||||
site = insert(:site, members: [current_owner])
|
||||
@ -315,7 +315,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do
|
||||
)
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "unlocks a previously locked site after transfer" do
|
||||
site = insert(:site, locked: true, memberships: [])
|
||||
existing_owner = insert(:user)
|
||||
@ -405,7 +405,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do
|
||||
refute Repo.reload(invitation)
|
||||
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
|
||||
old_owner = insert(:user, subscription: build(:business_subscription))
|
||||
new_owner = insert(:user, subscription: build(:growth_subscription))
|
||||
@ -432,7 +432,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do
|
||||
)
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "allows transferring ownership to existing site member when at team members limit" do
|
||||
old_owner = insert(:user, subscription: build(:business_subscription))
|
||||
new_owner = insert(:user, subscription: build(:growth_subscription))
|
||||
@ -462,7 +462,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do
|
||||
)
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "does not allow transferring ownership when sites limit exceeded" do
|
||||
old_owner = insert(:user, subscription: build(:business_subscription))
|
||||
new_owner = insert(:user, subscription: build(:growth_subscription))
|
||||
@ -486,7 +486,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do
|
||||
)
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "does not allow transferring ownership when pageview limit exceeded" do
|
||||
old_owner = insert(:user, subscription: build(:business_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)
|
||||
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
|
||||
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)
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "does not allow transferring ownership when many limits exceeded at once" do
|
||||
old_owner = insert(:user, subscription: build(:business_subscription))
|
||||
new_owner = insert(:user, subscription: build(:growth_subscription))
|
||||
|
@ -66,7 +66,7 @@ defmodule Plausible.Site.Memberships.CreateInvitationTest do
|
||||
)
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "returns error when owner is over their team member limit" do
|
||||
[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)
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "allows inviting users who were already invited to other sites, within the limit" do
|
||||
owner = insert(:user)
|
||||
|
||||
@ -107,7 +107,7 @@ defmodule Plausible.Site.Memberships.CreateInvitationTest do
|
||||
assert {:ok, _} = invite.(site2, "i3@example.com")
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "allows inviting users who are already members of other sites, within the limit" do
|
||||
[u1, u2, u3, u4] = insert_list(4, :user)
|
||||
|
||||
@ -385,7 +385,7 @@ defmodule Plausible.Site.Memberships.CreateInvitationTest do
|
||||
)
|
||||
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
|
||||
old_owner = insert(:user, subscription: build(:business_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)
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "allows transferring ownership to existing site member when at team members limit" do
|
||||
old_owner = insert(:user, subscription: build(:business_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)
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "does not allow transferring ownership when sites limit exceeded" do
|
||||
old_owner = insert(:user, subscription: build(:business_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)
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "exceeding limits error takes precedence over missing features" do
|
||||
old_owner = insert(:user, subscription: build(:business_subscription))
|
||||
new_owner = insert(:user, subscription: build(:growth_subscription))
|
||||
|
@ -114,7 +114,7 @@ defmodule Plausible.SitesTest do
|
||||
end
|
||||
|
||||
describe "get_for_user/2" do
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "get site for super_admin" do
|
||||
user1 = insert(:user)
|
||||
user2 = insert(:user)
|
||||
|
@ -177,13 +177,13 @@ defmodule Plausible.Stats.QueryTest do
|
||||
assert q.interval == "date"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "adds sample_threshold :infinite to query struct", %{site: site} do
|
||||
q = Query.from(site, %{"period" => "30d", "sample_threshold" => "infinite"})
|
||||
assert q.sample_threshold == :infinite
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "casts sample_threshold to integer in query struct", %{site: site} do
|
||||
q = Query.from(site, %{"period" => "30d", "sample_threshold" => "30000000"})
|
||||
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"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "limit_exceeded/1 when billable user is on trial displays upgrade link" do
|
||||
me = insert(:user)
|
||||
|
||||
@ -104,7 +104,7 @@ defmodule PlausibleWeb.Components.Billing.NoticeTest do
|
||||
assert rendered =~ "/billing/choose-plan"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "limit_exceeded/1 when billable user is on an enterprise plan displays support email" do
|
||||
me =
|
||||
insert(:user,
|
||||
@ -126,7 +126,7 @@ defmodule PlausibleWeb.Components.Billing.NoticeTest do
|
||||
assert rendered =~ "upgrade your subscription"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "limit_exceeded/1 when billable user is on a business plan displays support email" do
|
||||
me = insert(:user, subscription: build(:business_subscription))
|
||||
|
||||
|
@ -3,7 +3,7 @@ defmodule PlausibleWeb.AdminAuthControllerTest do
|
||||
alias Plausible.Release
|
||||
|
||||
describe "GET /" do
|
||||
@describetag :small_build_only
|
||||
@describetag :ce_build_only
|
||||
test "disable registration", %{conn: conn} do
|
||||
insert(:user)
|
||||
patch_config(disable_registration: true)
|
||||
|
@ -6,7 +6,7 @@ defmodule PlausibleWeb.AdminControllerTest do
|
||||
describe "GET /crm/auth/user/:user_id/usage" do
|
||||
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
|
||||
conn = get(conn, "/crm/auth/user/1/usage")
|
||||
assert response(conn, 403) == "Not allowed"
|
||||
@ -16,7 +16,7 @@ defmodule PlausibleWeb.AdminControllerTest do
|
||||
describe "POST /crm/sites/site/:site_id" do
|
||||
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
|
||||
patch_env(:super_admin_user_ids, [user.id])
|
||||
|
||||
|
@ -727,7 +727,7 @@ defmodule PlausibleWeb.Api.ExternalControllerTest do
|
||||
assert Map.get(event, :"meta.value") == ["true"]
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "converts revenue values into the goal currency", %{conn: conn, site: site} do
|
||||
params = %{
|
||||
name: "Payment",
|
||||
@ -744,7 +744,7 @@ defmodule PlausibleWeb.Api.ExternalControllerTest do
|
||||
assert Decimal.equal?(Decimal.new("7.14"), amount)
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "revenue values can be sent with minified keys", %{conn: conn, site: site} do
|
||||
params = %{
|
||||
"n" => "Payment",
|
||||
@ -761,7 +761,7 @@ defmodule PlausibleWeb.Api.ExternalControllerTest do
|
||||
assert Decimal.equal?(Decimal.new("7.14"), amount)
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "saves the exact same amount when goal currency is the same as the event", %{
|
||||
conn: conn,
|
||||
site: site
|
||||
|
@ -3,7 +3,7 @@ defmodule PlausibleWeb.Api.ExternalSitesControllerTest do
|
||||
use PlausibleWeb.ConnCase, async: false
|
||||
use Plausible.Repo
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
setup :create_user
|
||||
|
||||
setup %{conn: conn, user: user} do
|
||||
|
@ -67,7 +67,7 @@ defmodule PlausibleWeb.Api.ExternalStatsController.AuthTest do
|
||||
end
|
||||
|
||||
describe "super admin access" do
|
||||
@describetag :full_build_only
|
||||
@describetag :ee_only
|
||||
setup %{user: user} do
|
||||
patch_env(:super_admin_user_ids, [user.id])
|
||||
end
|
||||
|
@ -5,7 +5,7 @@ defmodule PlausibleWeb.Api.InternalController.SyncTest do
|
||||
describe "PUT /api/:domain/disable-feature" do
|
||||
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
|
||||
site = insert(:site)
|
||||
patch_env(:super_admin_user_ids, [user.id])
|
||||
|
@ -265,7 +265,7 @@ defmodule PlausibleWeb.Api.StatsController.ConversionsTest do
|
||||
]
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "returns formatted average and total values for a conversion with revenue value", %{
|
||||
conn: conn,
|
||||
site: site
|
||||
@ -306,7 +306,7 @@ defmodule PlausibleWeb.Api.StatsController.ConversionsTest do
|
||||
]
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "returns revenue goals as custom events if the plan doesn't cover the feature", %{
|
||||
conn: conn,
|
||||
site: site,
|
||||
@ -350,7 +350,7 @@ defmodule PlausibleWeb.Api.StatsController.ConversionsTest do
|
||||
]
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "returns revenue metrics as nil for non-revenue goals", %{
|
||||
conn: conn,
|
||||
site: site
|
||||
|
@ -745,7 +745,7 @@ defmodule PlausibleWeb.Api.StatsController.CustomPropBreakdownTest do
|
||||
]
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "returns revenue metrics when filtering by a revenue goal", %{conn: conn, site: site} do
|
||||
prop_key = "logged_in"
|
||||
|
||||
@ -803,7 +803,7 @@ defmodule PlausibleWeb.Api.StatsController.CustomPropBreakdownTest do
|
||||
]
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "returns revenue metrics when filtering by many revenue goals with same currency", %{
|
||||
conn: conn,
|
||||
site: site
|
||||
|
@ -1,9 +1,9 @@
|
||||
defmodule PlausibleWeb.Api.StatsController.FunnelsTest do
|
||||
use PlausibleWeb.ConnCase, async: true
|
||||
use Plausible
|
||||
@moduletag :full_build_only
|
||||
@moduletag :ee_only
|
||||
|
||||
on_full_build do
|
||||
on_ee do
|
||||
@user_id 123
|
||||
@other_user_id 456
|
||||
|
||||
|
@ -1101,7 +1101,7 @@ defmodule PlausibleWeb.Api.StatsController.MainGraphTest do
|
||||
end
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
describe "GET /api/stats/main-graph - total_revenue plot" do
|
||||
setup [:create_user, :log_in, :create_new_site, :create_legacy_site_import]
|
||||
|
||||
@ -1181,7 +1181,7 @@ defmodule PlausibleWeb.Api.StatsController.MainGraphTest do
|
||||
end
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
describe "GET /api/stats/main-graph - average_revenue plot" do
|
||||
setup [:create_user, :log_in, :create_new_site, :create_legacy_site_import]
|
||||
|
||||
|
@ -1102,7 +1102,7 @@ defmodule PlausibleWeb.Api.StatsController.TopStatsTest do
|
||||
]
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
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: "AddToCart", currency: "EUR")
|
||||
@ -1147,7 +1147,7 @@ defmodule PlausibleWeb.Api.StatsController.TopStatsTest do
|
||||
} in top_stats
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "returns average and total when filtering by many revenue goals with same currency", %{
|
||||
conn: conn,
|
||||
site: site
|
||||
|
@ -8,7 +8,7 @@ defmodule PlausibleWeb.AuthControllerSyncTest do
|
||||
describe "PUT /settings/email" do
|
||||
setup [:create_user, :log_in]
|
||||
|
||||
@tag :small_build_only
|
||||
@tag :ce_build_only
|
||||
test "updates email but DOES NOT force reverification when feature disabled", %{
|
||||
conn: conn,
|
||||
user: user
|
||||
|
@ -526,7 +526,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||
assert resp =~ "Change email address"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "shows subscription", %{conn: conn, user: user} do
|
||||
insert(:subscription, paddle_plan_id: "558018", user: user)
|
||||
conn = get(conn, "/settings")
|
||||
@ -534,7 +534,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||
assert html_response(conn, 200) =~ "monthly billing"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "shows yearly subscription", %{conn: conn, user: user} do
|
||||
insert(:subscription, paddle_plan_id: "590752", user: user)
|
||||
conn = get(conn, "/settings")
|
||||
@ -542,7 +542,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||
assert html_response(conn, 200) =~ "yearly billing"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "shows free subscription", %{conn: conn, user: user} do
|
||||
insert(:subscription, paddle_plan_id: "free_10k", user: user)
|
||||
conn = get(conn, "/settings")
|
||||
@ -550,7 +550,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||
assert html_response(conn, 200) =~ "N/A billing"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "shows enterprise plan subscription", %{conn: conn, user: user} do
|
||||
insert(:subscription, paddle_plan_id: "123", user: user)
|
||||
|
||||
@ -561,7 +561,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||
assert html_response(conn, 200) =~ "yearly billing"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "shows current enterprise plan subscription when user has a new one to upgrade to", %{
|
||||
conn: conn,
|
||||
user: user
|
||||
@ -585,7 +585,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||
assert html_response(conn, 200) =~ "yearly billing"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "renders two links to '/billing/choose-plan` with the text 'Upgrade'", %{conn: conn} do
|
||||
doc =
|
||||
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)
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "renders a link to '/billing/choose-plan' with the text 'Change plan' + cancel link", %{
|
||||
conn: conn,
|
||||
user: user
|
||||
@ -661,7 +661,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||
refute element_exists?(doc, "#upgrade-or-change-plan-link")
|
||||
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",
|
||||
%{conn: conn, user: user} do
|
||||
configure_enterprise_plan(user)
|
||||
@ -684,7 +684,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||
Routes.billing_path(conn, :choose_plan)
|
||||
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",
|
||||
%{conn: conn, user: user} do
|
||||
insert(:subscription, paddle_plan_id: @v3_plan_id, user: user)
|
||||
@ -706,7 +706,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||
Routes.billing_path(conn, :choose_plan)
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "renders cancelled subscription notice", %{conn: conn, user: user} do
|
||||
insert(:subscription,
|
||||
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"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "renders cancelled subscription notice with some subscription days still left", %{
|
||||
conn: conn,
|
||||
user: user
|
||||
@ -746,7 +746,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||
assert notice_text =~ "Upgrade your subscription to make sure you don't lose access"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "renders cancelled subscription notice with a warning about losing grandfathering", %{
|
||||
conn: conn,
|
||||
user: user
|
||||
@ -770,7 +770,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||
"by letting your subscription expire, you lose access to our grandfathered terms"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "shows invoices for subscribed user", %{conn: conn, user: user} do
|
||||
insert(:subscription,
|
||||
paddle_plan_id: "558018",
|
||||
@ -785,7 +785,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||
assert html_response(conn, 200) =~ "$22.00"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "shows 'something went wrong' on failed invoice request'", %{conn: conn, user: user} do
|
||||
insert(:subscription,
|
||||
paddle_plan_id: "558018",
|
||||
@ -811,7 +811,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||
refute html_response(conn, 200) =~ "Invoices"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "renders pageview usage for current, last, and penultimate billing cycles", %{
|
||||
conn: conn,
|
||||
user: user
|
||||
@ -876,7 +876,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||
assert text_of_element(doc, "#custom_events_penultimate_cycle") =~ "Custom events 1"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "renders pageview usage per billing cycle for active subscribers", %{
|
||||
conn: conn,
|
||||
user: user
|
||||
@ -919,7 +919,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||
get(conn, "/settings") |> html_response(200) |> assert_cycles_rendered.()
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "penultimate cycle is disabled if there's no usage", %{conn: conn, user: user} do
|
||||
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"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "penultimate and last cycles are both disabled if there's no usage", %{
|
||||
conn: conn,
|
||||
user: user
|
||||
@ -982,7 +982,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||
assert text_of_element(doc, "#billing_cycle_tab_penultimate_cycle") =~ "Not available"
|
||||
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", %{
|
||||
conn: conn,
|
||||
user: user
|
||||
@ -1016,7 +1016,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||
refute text_of_element(doc, "#billing_cycle_tab_penultimate_cycle") =~ "Not available"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "renders last 30 days pageview usage for trials and non-active/free_10k subscriptions",
|
||||
%{
|
||||
conn: conn,
|
||||
@ -1072,7 +1072,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||
get(conn, "/settings") |> html_response(200) |> assert_usage.()
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "renders sites usage and limit", %{conn: conn, user: user} do
|
||||
insert(:subscription, paddle_plan_id: @v3_plan_id, user: user)
|
||||
insert(:site, members: [user])
|
||||
@ -1086,7 +1086,7 @@ defmodule PlausibleWeb.AuthControllerTest do
|
||||
assert site_usage_row_text =~ "Owned sites 1 / 50"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "renders team members usage and limit", %{conn: conn, user: user} do
|
||||
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"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
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)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
defmodule PlausibleWeb.ErrorReportControllerTest do
|
||||
use PlausibleWeb.ConnCase, async: true
|
||||
@moduletag :full_build_only
|
||||
@moduletag :ee_only
|
||||
|
||||
use Bamboo.Test
|
||||
|
||||
|
@ -85,7 +85,7 @@ defmodule PlausibleWeb.Site.InvitationControllerTest do
|
||||
assert new_owner_membership.role == :owner
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "fails when new owner has no plan", %{conn: conn, user: user} do
|
||||
old_owner = insert(:user)
|
||||
site = insert(:site, members: [old_owner])
|
||||
@ -101,7 +101,7 @@ defmodule PlausibleWeb.Site.InvitationControllerTest do
|
||||
"No existing subscription"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "fails when new owner's plan is unsuitable", %{conn: conn, user: user} do
|
||||
old_owner = insert(:user)
|
||||
site = insert(:site, members: [old_owner])
|
||||
|
@ -21,7 +21,7 @@ defmodule PlausibleWeb.Site.MembershipControllerTest do
|
||||
refute element_exists?(html, ~s/button[type=submit][disabled]/)
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "display a notice when is over limit", %{conn: conn, user: user} do
|
||||
memberships = [
|
||||
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"
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "fails to create invitation when is over limit", %{conn: conn, user: user} do
|
||||
memberships = [
|
||||
build(:site_membership, user: user, role: :owner) | build_list(5, :site_membership)
|
||||
|
@ -305,7 +305,7 @@ defmodule PlausibleWeb.SiteControllerTest do
|
||||
assert_no_emails_delivered()
|
||||
end
|
||||
|
||||
@tag :full_build_only
|
||||
@tag :ee_only
|
||||
test "does not allow site creation when the user is at their site limit", %{
|
||||
conn: conn,
|
||||
user: user
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user