From ab714bb4b8d2fecf299fd557a3c1f0dc4b1036b7 Mon Sep 17 00:00:00 2001 From: Vinicius Brasil Date: Thu, 9 Nov 2023 22:26:08 -0300 Subject: [PATCH] Improve wording in billing notices --- lib/plausible_web/components/billing.ex | 21 +++++++++++-------- .../plausible_web/components/billing_test.exs | 18 ++++++++-------- .../controllers/site_controller_test.exs | 2 +- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/lib/plausible_web/components/billing.ex b/lib/plausible_web/components/billing.ex index aac1a129d..d4abc1276 100644 --- a/lib/plausible_web/components/billing.ex +++ b/lib/plausible_web/components/billing.ex @@ -50,7 +50,7 @@ defmodule PlausibleWeb.Components.Billing do not has_access? -> ~H""" <.notice class="rounded-t-md rounded-b-none" size={@size} {@rest}> - This account does not have access to <%= assigns.feature_mod.display_name() %>. To get access to this feature, + <%= account_label(@current_user, @billable_user) %> does not have access to <%= assigns.feature_mod.display_name() %>. To get access to this feature, <.upgrade_call_to_action current_user={@current_user} billable_user={@billable_user} />. """ @@ -82,7 +82,7 @@ defmodule PlausibleWeb.Components.Billing do def limit_exceeded_notice(assigns) do ~H""" <.notice {@rest}> - This account is limited to <%= @limit %> <%= @resource %>. To increase this limit, + <%= account_label(@current_user, @billable_user) %> is limited to <%= @limit %> <%= @resource %>. To increase this limit, <.upgrade_call_to_action current_user={@current_user} billable_user={@billable_user} />. """ @@ -90,7 +90,6 @@ defmodule PlausibleWeb.Components.Billing do attr(:current_user, :map) attr(:billable_user, :map) - attr(:plan, :atom) defp upgrade_call_to_action(assigns) do billable_user = Plausible.Users.with_subscription(assigns.billable_user) @@ -103,9 +102,7 @@ defmodule PlausibleWeb.Components.Billing do cond do assigns.billable_user.id !== assigns.current_user.id -> - ~H""" - please reach out to the site owner to upgrade their subscription - """ + ~H"please reach out to the site owner to upgrade their subscription" growth? || trial? -> ~H""" @@ -116,9 +113,15 @@ defmodule PlausibleWeb.Components.Billing do """ true -> - ~H""" - please contact support@plausible.io about the Enterprise plan - """ + ~H"please contact support@plausible.io about the Enterprise plan" + end + end + + defp account_label(current_user, billable_user) do + if current_user.id == billable_user.id do + "Your account" + else + "The owner of this site" end end diff --git a/test/plausible_web/components/billing_test.exs b/test/plausible_web/components/billing_test.exs index 1a4fb3254..befcf44e4 100644 --- a/test/plausible_web/components/billing_test.exs +++ b/test/plausible_web/components/billing_test.exs @@ -24,7 +24,7 @@ defmodule PlausibleWeb.Components.BillingTest do feature_mod: Plausible.Billing.Feature.Props ) - assert rendered =~ "This account does not have access to Custom Properties" + assert rendered =~ "Your account does not have access to Custom Properties" assert rendered =~ "upgrade your subscription" assert rendered =~ "/billing/choose-plan" end @@ -40,7 +40,7 @@ defmodule PlausibleWeb.Components.BillingTest do feature_mod: Plausible.Billing.Feature.Funnels ) - assert rendered =~ "This account does not have access to 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" end @@ -68,7 +68,7 @@ defmodule PlausibleWeb.Components.BillingTest do resource: "users" ) - assert rendered =~ "This account is limited to 10 users. To increase this limit" + assert rendered =~ "Your account is limited to 10 users. To increase this limit" assert rendered =~ "upgrade your subscription" assert rendered =~ "/billing/choose-plan" end @@ -84,7 +84,7 @@ defmodule PlausibleWeb.Components.BillingTest do resource: "users" ) - assert rendered =~ "This account is limited to 10 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" end @@ -99,7 +99,7 @@ defmodule PlausibleWeb.Components.BillingTest do resource: "users" ) - assert rendered =~ "This account is limited to 10 users" + assert rendered =~ "Your account is limited to 10 users" assert rendered =~ "upgrade your subscription" assert rendered =~ "/billing/choose-plan" end @@ -119,8 +119,8 @@ defmodule PlausibleWeb.Components.BillingTest do resource: "users" ) - assert rendered =~ - "This account is limited to 10 users. To increase this limit, please contact support@plausible.io about the Enterprise plan" + assert rendered =~ "Your account is limited to 10 users." + assert rendered =~ "please contact support@plausible.io about the Enterprise plan" end test "limit_exceeded_notice/1 when billable user is on a business plan displays support email" do @@ -134,7 +134,7 @@ defmodule PlausibleWeb.Components.BillingTest do resource: "users" ) - assert rendered =~ - "This account is limited to 10 users. To increase this limit, please contact support@plausible.io about the Enterprise plan" + assert rendered =~ "Your account is limited to 10 users." + assert rendered =~ "please contact support@plausible.io about the Enterprise plan" end end diff --git a/test/plausible_web/controllers/site_controller_test.exs b/test/plausible_web/controllers/site_controller_test.exs index c0f13a9f0..e7d431982 100644 --- a/test/plausible_web/controllers/site_controller_test.exs +++ b/test/plausible_web/controllers/site_controller_test.exs @@ -286,7 +286,7 @@ defmodule PlausibleWeb.SiteControllerTest do }) assert html = html_response(conn, 200) - assert html =~ "This account is limited to 10 sites" + assert html =~ "Your account is limited to 10 sites" refute Repo.get_by(Plausible.Site, domain: "over-limit.example.com") end