Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.
TypeScript analyticsanalytics-dashboardclickhouseelixirgoogle-analyticsmarketingopen-source-analyticsphoenixplausible-analyticspostgresqlprivacyprivacy-friendlyself-hostedsimple-analyticsstatisticstailwindcssweb-analyticswebsite-analyticswebsite-statswebsite-tracking
Adjust notices & permissions (#5348)
hq1b9ee37ef8c11
diff --git a/lib/plausible_web/components/billing/notice.ex b/lib/plausible_web/components/billing/notice.exindex a97fd0ee86..408e97bdcd 100644--- a/lib/plausible_web/components/billing/notice.ex+++ b/lib/plausible_web/components/billing/notice.ex@@ -77,7 +77,7 @@ defmodule PlausibleWeb.Components.Billing.Notice dotitle="Notice"{@rest}>- {account_label(@current_role)} does not have access to {@feature_mod.display_name()}. To get access to this feature,+ {account_label(@current_team)} does not have access to {@feature_mod.display_name()}. To gain access to this feature,<.upgrade_call_to_action current_role={@current_role} current_team={@current_team} />.</.notice>"""@@ -92,7 +92,7 @@ defmodule PlausibleWeb.Components.Billing.Notice dodef limit_exceeded(assigns) do~H"""<.notice {@rest} title="Notice">- {account_label(@current_role)} is limited to {@limit} {@resource}. To increase this limit,+ {account_label(@current_team)} is limited to {@limit} {@resource}. To increase this limit,<.upgrade_call_to_action current_team={@current_team} current_role={@current_role} />.</.notice>"""@@ -330,8 +330,8 @@ defmodule PlausibleWeb.Components.Billing.Notice doendcond do- assigns.current_role not in [:owner, :billing] ->- ~H"please reach out to the site owner to upgrade their subscription"+ not is_nil(assigns.current_role) and assigns.current_role not in [:owner, :billing] ->+ ~H"please reach out to the team owner to upgrade their subscription"upgrade_assistance_required? ->~H"""@@ -352,11 +352,11 @@ defmodule PlausibleWeb.Components.Billing.Notice doendend- defp account_label(current_role) do- if current_role in [:owner, :billing] do- "Your account"+ defp account_label(current_team) do+ if current_team do+ "This team"else- "The owner of this site"+ "This account"endendenddiff --git a/lib/plausible_web/controllers/billing_controller.ex b/lib/plausible_web/controllers/billing_controller.exindex 93805afaed..cec491d030 100644--- a/lib/plausible_web/controllers/billing_controller.ex+++ b/lib/plausible_web/controllers/billing_controller.ex@@ -8,7 +8,7 @@ defmodule PlausibleWeb.BillingController doplug PlausibleWeb.RequireAccountPlug- plug Plausible.Plugs.AuthorizeTeamAccess, [:owner, :admin, :billing]+ plug Plausible.Plugs.AuthorizeTeamAccess, [:owner, :billing]def ping_subscription(%Plug.Conn{} = conn, _params) dosubscribed? = Plausible.Teams.Billing.has_active_subscription?(conn.assigns.current_team)diff --git a/lib/plausible_web/controllers/settings_controller.ex b/lib/plausible_web/controllers/settings_controller.exindex 422151609a..0457d73bce 100644--- a/lib/plausible_web/controllers/settings_controller.ex+++ b/lib/plausible_web/controllers/settings_controller.ex@@ -12,7 +12,7 @@ defmodule PlausibleWeb.SettingsController do[:owner, :admin] when action in [:update_team_name]plug Plausible.Plugs.AuthorizeTeamAccess,- [:owner, :admin, :billing] when action in [:subscription, :invoices]+ [:owner, :billing] when action in [:subscription, :invoices]plug Plausible.Plugs.AuthorizeTeamAccess,[:owner] when action in [:team_danger_zone, :delete_team]diff --git a/lib/plausible_web/live/team_management.ex b/lib/plausible_web/live/team_management.exindex ab10b38fce..9c940cbc99 100644--- a/lib/plausible_web/live/team_management.ex+++ b/lib/plausible_web/live/team_management.ex@@ -46,7 +46,7 @@ defmodule PlausibleWeb.Live.TeamManagement docurrent_role={@current_team_role}current_team={@current_team}limit={@team_members_limit}- resource="team members"+ resource="members"class="mb-4"/><div>diff --git a/lib/plausible_web/templates/site/membership/invite_member_form.html.heex b/lib/plausible_web/templates/site/membership/invite_member_form.html.heexindex 8e2a05433b..0accd542e2 100644--- a/lib/plausible_web/templates/site/membership/invite_member_form.html.heex+++ b/lib/plausible_web/templates/site/membership/invite_member_form.html.heex@@ -14,7 +14,7 @@current_role={@current_team_role}current_team={@site_team}limit={Map.get(assigns, :team_member_limit, 0)}- resource="team members"+ resource="members"/><div class="my-6">diff --git a/lib/plausible_web/views/layout_view.ex b/lib/plausible_web/views/layout_view.exindex 733fdb82dc..6d1021cb48 100644--- a/lib/plausible_web/views/layout_view.ex+++ b/lib/plausible_web/views/layout_view.ex@@ -124,13 +124,15 @@ defmodule PlausibleWeb.LayoutView do"Team Settings",[%{key: "General", value: "team/general", icon: :adjustments_horizontal},- if(current_team_role in [:owner, :admin, :billing],+ if(current_team_role in [:owner, :billing],do: %{key: "Subscription", value: "billing/subscription", icon: :circle_stack}),- if(current_team_role in [:owner, :admin, :billing],+ if(current_team_role in [:owner, :billing],do: %{key: "Invoices", value: "billing/invoices", icon: :banknotes}),- %{key: "API Keys", value: "api-keys", icon: :key},+ if(current_team_role in [:owner, :billing, :admin, :editor],+ do: %{key: "API Keys", value: "api-keys", icon: :key}+ ),if(current_team_role == :owner,do: %{key: "Danger Zone", value: "team/delete", icon: :exclamation_triangle})diff --git a/test/plausible_web/components/billing/notice_test.exs b/test/plausible_web/components/billing/notice_test.exsindex cda94570e1..53923c023a 100644--- a/test/plausible_web/components/billing/notice_test.exs+++ b/test/plausible_web/components/billing/notice_test.exs@@ -25,7 +25,7 @@ defmodule PlausibleWeb.Components.Billing.NoticeTest dofeature_mod: Plausible.Billing.Feature.Props)- assert rendered =~ "Your account does not have access to Custom Properties"+ assert rendered =~ "This team does not have access to Custom Properties"assert rendered =~ "upgrade your subscription"assert rendered =~ "/billing/choose-plan"end@@ -41,7 +41,7 @@ defmodule PlausibleWeb.Components.Billing.NoticeTest dofeature_mod: Plausible.Billing.Feature.Props)- assert rendered =~ "Your account does not have access to Custom Properties"+ assert rendered =~ "This team does not have access to Custom Properties"assert rendered =~ "upgrade your subscription"assert rendered =~ "/billing/choose-plan"end@@ -56,8 +56,8 @@ defmodule PlausibleWeb.Components.Billing.NoticeTest dofeature_mod: Plausible.Billing.Feature.Funnels)- assert rendered =~ "The owner of this site does not have access to Funnels"- assert rendered =~ "please reach out to the site owner to upgrade their subscription"+ assert rendered =~ "This team does not have access to Funnels"+ assert rendered =~ "please reach out to the team owner to upgrade their subscription"endtest "premium_feature/1 does not render a notice when the user has access to the feature" do@@ -73,6 +73,18 @@ defmodule PlausibleWeb.Components.Billing.NoticeTest doassert rendered == ""end+ test "premium_feature/1 for team-less account" do+ rendered =+ render_component(&Notice.premium_feature/1,+ current_role: nil,+ current_team: nil,+ feature_mod: Plausible.Billing.Feature.Funnels+ )++ assert rendered =~ "This account does not have access to Funnels"+ assert rendered =~ "upgrade your subscription"+ end+test "limit_exceeded/1 when team is on growth displays upgrade link" dome = new_user() |> subscribe_to_growth_plan()team = team_of(me)@@ -85,7 +97,7 @@ defmodule PlausibleWeb.Components.Billing.NoticeTest doresource: "users")- assert rendered =~ "Your account is limited to 10 users. To increase this limit"+ assert rendered =~ "This team is limited to 10 users. To increase this limit"assert rendered =~ "upgrade your subscription"assert rendered =~ "/billing/choose-plan"end@@ -101,8 +113,8 @@ defmodule PlausibleWeb.Components.Billing.NoticeTest doresource: "users")- assert rendered =~ "The owner of this site is limited to 10 users"- assert rendered =~ "please reach out to the site owner to upgrade their subscription"+ assert rendered =~ "This team is limited to 10 users"+ assert rendered =~ "please reach out to the team owner to upgrade their subscription"end@tag :ee_only@@ -117,7 +129,7 @@ defmodule PlausibleWeb.Components.Billing.NoticeTest doresource: "users")- assert rendered =~ "Your account is limited to 10 users"+ assert rendered =~ "This team is limited to 10 users"assert rendered =~ "upgrade your subscription"assert rendered =~ "/billing/choose-plan"end@@ -134,7 +146,7 @@ defmodule PlausibleWeb.Components.Billing.NoticeTest doresource: "users")- assert rendered =~ "Your account is limited to 10 users."+ assert rendered =~ "This team is limited to 10 users."assert rendered =~ "[email protected]"assert rendered =~ "upgrade your subscription"@@ -153,7 +165,7 @@ defmodule PlausibleWeb.Components.Billing.NoticeTest doresource: "users")- assert rendered =~ "Your account is limited to 10 users."+ assert rendered =~ "This team is limited to 10 users."assert rendered =~ "[email protected]"assert rendered =~ "upgrade your subscription"diff --git a/test/plausible_web/controllers/site/membership_controller_test.exs b/test/plausible_web/controllers/site/membership_controller_test.exsindex 69a06e3e05..dce20d57b1 100644--- a/test/plausible_web/controllers/site/membership_controller_test.exs+++ b/test/plausible_web/controllers/site/membership_controller_test.exs@@ -39,7 +39,7 @@ defmodule PlausibleWeb.Site.MembershipControllerTest do|> get("/sites/#{site.domain}/memberships/invite")|> html_response(200)- assert html =~ "Your account is limited to 3 team members"+ assert html =~ "This team is limited to 3 members"endenddiff --git a/test/plausible_web/controllers/site_controller_test.exs b/test/plausible_web/controllers/site_controller_test.exsindex e5d7e1a335..1a387d9312 100644--- a/test/plausible_web/controllers/site_controller_test.exs+++ b/test/plausible_web/controllers/site_controller_test.exs@@ -329,7 +329,7 @@ defmodule PlausibleWeb.SiteControllerTest do})assert html = html_response(conn, 200)- assert html =~ "Your account is limited to 10 sites"+ assert html =~ "This team is limited to 10 sites"refute Repo.get_by(Plausible.Site, domain: "over-limit.example.com")enddiff --git a/test/plausible_web/live/team_setup_test.exs b/test/plausible_web/live/team_setup_test.exsindex 0b96ddea5c..5a6f5e806e 100644--- a/test/plausible_web/live/team_setup_test.exs+++ b/test/plausible_web/live/team_setup_test.exs@@ -215,7 +215,7 @@ defmodule PlausibleWeb.Live.TeamSetupTest doassert attr_defined?(html, ~s|#team-layout-form input[name="input-email"]|, "readonly")assert attr_defined?(html, ~s|#invite-member|, "disabled")- assert text(html) =~ "Your account is limited to 3 team members"+ assert text(html) =~ "This team is limited to 3 members"endtest "all options are disabled for the sole owner", %{conn: conn} dodiff --git a/test/support/dev/controllers/dev_subscription_controller.ex b/test/support/dev/controllers/dev_subscription_controller.exindex 4702c5b2ec..b1b90d0dcc 100644--- a/test/support/dev/controllers/dev_subscription_controller.ex+++ b/test/support/dev/controllers/dev_subscription_controller.ex@@ -8,7 +8,7 @@ defmodule PlausibleWeb.DevSubscriptionController doplug PlausibleWeb.RequireAccountPlug- plug Plausible.Plugs.AuthorizeTeamAccess, [:owner, :admin, :billing]+ plug Plausible.Plugs.AuthorizeTeamAccess, [:owner, :billing]def create_form(conn, %{"plan_id" => plan_id}) dorender(conn, "create_dev_subscription.html",