From aaf191f50ae459af9917d1f1763a7244ef833228 Mon Sep 17 00:00:00 2001 From: ruslandoga <67764432+ruslandoga@users.noreply.github.com> Date: Thu, 23 May 2024 13:21:19 +0700 Subject: [PATCH 1/3] remove Plausible Analytics metions from CE --- Dockerfile | 2 +- lib/plausible.ex | 10 +++++ lib/plausible/auth/totp.ex | 6 +-- lib/plausible_web/email.ex | 38 +++++++------------ lib/plausible_web/live/register_form.ex | 4 +- .../mjml/templates/stats_report.mjml.eex | 2 +- ...approaching_accept_traffic_until.html.heex | 2 +- .../templates/email/dashboard_locked.html.eex | 2 +- .../email/existing_user_invitation.html.eex | 2 +- .../templates/email/export_failure.html.eex | 2 +- .../templates/email/export_success.html.eex | 2 +- .../email/new_user_invitation.html.eex | 2 +- .../templates/email/over_limit.html.eex | 2 +- .../email/ownership_transfer_request.html.eex | 2 +- .../yearly_expiration_notification.html.eex | 2 +- .../yearly_renewal_notification.html.eex | 2 +- .../templates/layout/focus.html.heex | 8 ++-- .../templates/page/index.html.eex | 4 +- .../site/settings_search_console.html.heex | 2 +- 19 files changed, 48 insertions(+), 48 deletions(-) diff --git a/Dockerfile b/Dockerfile index 617d10e304e2..26e75aa97d76 100644 --- a/Dockerfile +++ b/Dockerfile @@ -63,7 +63,7 @@ ENV LANG=C.UTF-8 ARG MIX_ENV=ce ENV MIX_ENV=$MIX_ENV -RUN adduser -S -H -u 999 -G nogroup plausible -g 'Plausible Analytics' +RUN adduser -S -H -u 999 -G nogroup plausible RUN apk upgrade --no-cache RUN apk add --no-cache openssl ncurses libstdc++ libgcc ca-certificates diff --git a/lib/plausible.ex b/lib/plausible.ex index e853b470da0f..45eef3a99593 100644 --- a/lib/plausible.ex +++ b/lib/plausible.ex @@ -57,4 +57,14 @@ defmodule Plausible do end end end + + if Mix.env() in @ce_builds do + def product_name do + "Plausible CE" + end + else + def product_name do + "Plausible Analytics" + end + end end diff --git a/lib/plausible/auth/totp.ex b/lib/plausible/auth/totp.ex index 23529faaddf1..e12f6ebc7194 100644 --- a/lib/plausible/auth/totp.ex +++ b/lib/plausible/auth/totp.ex @@ -88,7 +88,6 @@ defmodule Plausible.Auth.TOTP do alias Plausible.Repo alias PlausibleWeb.Email - @issuer_name "Plausible Analytics" @recovery_codes_count 10 @spec enabled?(Auth.User.t()) :: boolean() @@ -298,9 +297,8 @@ defmodule Plausible.Auth.TOTP do end defp totp_uri(user) do - NimbleTOTP.otpauth_uri("#{@issuer_name}:#{user.email}", user.totp_secret, - issuer: @issuer_name - ) + issuer_name = Plausible.product_name() + NimbleTOTP.otpauth_uri("#{issuer_name}:#{user.email}", user.totp_secret, issuer: issuer_name) end defp readable_secret(user) do diff --git a/lib/plausible_web/email.ex b/lib/plausible_web/email.ex index ea1c4c01190c..b6330ea20e41 100644 --- a/lib/plausible_web/email.ex +++ b/lib/plausible_web/email.ex @@ -224,7 +224,7 @@ defmodule PlausibleWeb.Email do priority_email() |> to(invitation.email) |> tag("new-user-invitation") - |> subject("[Plausible Analytics] You've been invited to #{invitation.site.domain}") + |> subject("[#{Plausible.product_name()}] You've been invited to #{invitation.site.domain}") |> render("new_user_invitation.html", invitation: invitation ) @@ -234,7 +234,7 @@ defmodule PlausibleWeb.Email do priority_email() |> to(invitation.email) |> tag("existing-user-invitation") - |> subject("[Plausible Analytics] You've been invited to #{invitation.site.domain}") + |> subject("[#{Plausible.product_name()}] You've been invited to #{invitation.site.domain}") |> render("existing_user_invitation.html", invitation: invitation ) @@ -244,7 +244,9 @@ defmodule PlausibleWeb.Email do priority_email() |> to(invitation.email) |> tag("ownership-transfer-request") - |> subject("[Plausible Analytics] Request to transfer ownership of #{invitation.site.domain}") + |> subject( + "[#{Plausible.product_name()}] Request to transfer ownership of #{invitation.site.domain}" + ) |> render("ownership_transfer_request.html", invitation: invitation, new_owner_account: new_owner_account @@ -256,7 +258,7 @@ defmodule PlausibleWeb.Email do |> to(invitation.inviter.email) |> tag("invitation-accepted") |> subject( - "[Plausible Analytics] #{invitation.email} accepted your invitation to #{invitation.site.domain}" + "[#{Plausible.product_name()}] #{invitation.email} accepted your invitation to #{invitation.site.domain}" ) |> render("invitation_accepted.html", user: invitation.inviter, @@ -269,7 +271,7 @@ defmodule PlausibleWeb.Email do |> to(invitation.inviter.email) |> tag("invitation-rejected") |> subject( - "[Plausible Analytics] #{invitation.email} rejected your invitation to #{invitation.site.domain}" + "[#{Plausible.product_name()}] #{invitation.email} rejected your invitation to #{invitation.site.domain}" ) |> render("invitation_rejected.html", user: invitation.inviter, @@ -282,7 +284,7 @@ defmodule PlausibleWeb.Email do |> to(invitation.inviter.email) |> tag("ownership-transfer-accepted") |> subject( - "[Plausible Analytics] #{invitation.email} accepted the ownership transfer of #{invitation.site.domain}" + "[#{Plausible.product_name()}] #{invitation.email} accepted the ownership transfer of #{invitation.site.domain}" ) |> render("ownership_transfer_accepted.html", user: invitation.inviter, @@ -295,7 +297,7 @@ defmodule PlausibleWeb.Email do |> to(invitation.inviter.email) |> tag("ownership-transfer-rejected") |> subject( - "[Plausible Analytics] #{invitation.email} rejected the ownership transfer of #{invitation.site.domain}" + "[#{Plausible.product_name()}] #{invitation.email} rejected the ownership transfer of #{invitation.site.domain}" ) |> render("ownership_transfer_rejected.html", user: invitation.inviter, @@ -307,7 +309,9 @@ defmodule PlausibleWeb.Email do priority_email() |> to(membership.user.email) |> tag("site-member-removed") - |> subject("[Plausible Analytics] Your access to #{membership.site.domain} has been revoked") + |> subject( + "[#{Plausible.product_name()}] Your access to #{membership.site.domain} has been revoked" + ) |> render("site_member_removed.html", user: membership.user, membership: membership @@ -348,13 +352,6 @@ defmodule PlausibleWeb.Email do end def export_success(user, site, expires_at) do - subject = - on_ee do - "Your Plausible Analytics export is now ready for download" - else - "Your export is now ready for download" - end - expires_in = if expires_at do Timex.Format.DateTime.Formatters.Relative.format!( @@ -373,7 +370,7 @@ defmodule PlausibleWeb.Email do priority_email() |> to(user) |> tag("export-success") - |> subject(subject) + |> subject("[#{Plausible.product_name()}] Your export is now ready for download") |> render("export_success.html", user: user, site: site, @@ -383,16 +380,9 @@ defmodule PlausibleWeb.Email do end def export_failure(user, site) do - subject = - on_ee do - "Your Plausible Analytics export has failed" - else - "Your export has failed" - end - priority_email() |> to(user) - |> subject(subject) + |> subject("[#{Plausible.product_name()}] Your export has failed") |> render("export_failure.html", user: user, site: site) end diff --git a/lib/plausible_web/live/register_form.ex b/lib/plausible_web/live/register_form.ex index 422a1c447fb5..e3cae5802f0d 100644 --- a/lib/plausible_web/live/register_form.ex +++ b/lib/plausible_web/live/register_form.ex @@ -42,7 +42,7 @@ defmodule PlausibleWeb.Live.RegisterForm do def render(%{invitation_expired: true} = assigns) do ~H"""
-

Plausible Analytics

+

<%= Plausible.product_name() %>

Lightweight and privacy-friendly web analytics
@@ -65,7 +65,7 @@ defmodule PlausibleWeb.Live.RegisterForm do

<%= if ce?() or @live_action == :register_from_invitation_form do %> - Register your Plausible Analytics account + Register your <%= Plausible.product_name() %> account <% else %> Register your 30-day free trial <% end %> diff --git a/lib/plausible_web/mjml/templates/stats_report.mjml.eex b/lib/plausible_web/mjml/templates/stats_report.mjml.eex index 5baff5a95a02..93f969590cac 100644 --- a/lib/plausible_web/mjml/templates/stats_report.mjml.eex +++ b/lib/plausible_web/mjml/templates/stats_report.mjml.eex @@ -16,7 +16,7 @@ - Plausible Analytics + <%= Plausible.product_name() %> <%= @site.domain %> diff --git a/lib/plausible_web/templates/email/approaching_accept_traffic_until.html.heex b/lib/plausible_web/templates/email/approaching_accept_traffic_until.html.heex index 88e2f71e6f44..4cb3e664f3df 100644 --- a/lib/plausible_web/templates/email/approaching_accept_traffic_until.html.heex +++ b/lib/plausible_web/templates/email/approaching_accept_traffic_until.html.heex @@ -1,4 +1,4 @@ -You used to have an active account with Plausible Analytics, a simple, lightweight, open source and privacy-first Google Analytics alternative. +You used to have an active account with <%= Plausible.product_name() %>, a simple, lightweight, open source and privacy-first Google Analytics alternative.

We've noticed that you're still sending us stats so we're writing to inform you that we'll stop accepting stats from your sites <%= @time %>. We're an independent, bootstrapped service and we don't sell your data, so this will reduce our server costs and help keep us sustainable.

If you'd like to continue counting your site stats in a privacy-friendly way, please diff --git a/lib/plausible_web/templates/email/dashboard_locked.html.eex b/lib/plausible_web/templates/email/dashboard_locked.html.eex index 64d2dc944b3a..342b44f590ef 100644 --- a/lib/plausible_web/templates/email/dashboard_locked.html.eex +++ b/lib/plausible_web/templates/email/dashboard_locked.html.eex @@ -1,4 +1,4 @@ -Last week we sent a reminder that your site traffic has exceeded the limits of your Plausible Analytics subscription tier for two consecutive months. Since we haven't received a response, we've had to temporarily lock access to your stats. +Last week we sent a reminder that your site traffic has exceeded the limits of your <%= Plausible.product_name() %> subscription tier for two consecutive months. Since we haven't received a response, we've had to temporarily lock access to your stats.

Your subscription is still active, we're still counting your stats and haven't deleted any of your data but as you have outgrown your subscription tier, we kindly ask you to upgrade to match your new traffic levels. Upon upgrading to a suitable tier, your dashboard access will be immediately restored.

diff --git a/lib/plausible_web/templates/email/existing_user_invitation.html.eex b/lib/plausible_web/templates/email/existing_user_invitation.html.eex index 3bdd91a1813f..32554a2320b9 100644 --- a/lib/plausible_web/templates/email/existing_user_invitation.html.eex +++ b/lib/plausible_web/templates/email/existing_user_invitation.html.eex @@ -1,3 +1,3 @@ -<%= @invitation.inviter.email %> has invited you to the <%= @invitation.site.domain %> site on Plausible Analytics. +<%= @invitation.inviter.email %> has invited you to the <%= @invitation.site.domain %> site on <%= Plausible.product_name() %>. <%= link("Click here", to: Routes.site_url(PlausibleWeb.Endpoint, :index)) %> to view and respond to the invitation. The invitation will expire 48 hours after this email is sent. diff --git a/lib/plausible_web/templates/email/export_failure.html.eex b/lib/plausible_web/templates/email/export_failure.html.eex index f4163bbfe3b6..fc58418bf1e3 100644 --- a/lib/plausible_web/templates/email/export_failure.html.eex +++ b/lib/plausible_web/templates/email/export_failure.html.eex @@ -1,4 +1,4 @@ -Your <%= if ee?() do %>Plausible Analytics <% end %>export for <%= @site.domain %> has encountered an error and was unsuccessful. +Your <%= Plausible.product_name() %> export for <%= @site.domain %> has encountered an error and was unsuccessful. Sorry for the trouble this may have caused.

Please attempt to export your data again. diff --git a/lib/plausible_web/templates/email/export_success.html.eex b/lib/plausible_web/templates/email/export_success.html.eex index 541a0e11b5c7..636bed8e6da2 100644 --- a/lib/plausible_web/templates/email/export_success.html.eex +++ b/lib/plausible_web/templates/email/export_success.html.eex @@ -1,3 +1,3 @@ -Your <%= if ee?() do %>Plausible Analytics <% end %>export for <%= @site.domain %> is now ready for download. +Your <%= Plausible.product_name() %> export for <%= @site.domain %> is now ready for download. Please click here to start the download process. <%= if @expires_in do %>Note that this link will expire <%= @expires_in %>.<% end %> diff --git a/lib/plausible_web/templates/email/new_user_invitation.html.eex b/lib/plausible_web/templates/email/new_user_invitation.html.eex index ffef74616441..3bb9c59cd3f6 100644 --- a/lib/plausible_web/templates/email/new_user_invitation.html.eex +++ b/lib/plausible_web/templates/email/new_user_invitation.html.eex @@ -1,4 +1,4 @@ -<%= @invitation.inviter.email %> has invited you to join the <%= @invitation.site.domain %> site on Plausible Analytics. +<%= @invitation.inviter.email %> has invited you to join the <%= @invitation.site.domain %> site on <%= Plausible.product_name() %>. <%= link("Click here", to: Routes.auth_url(PlausibleWeb.Endpoint, :register_from_invitation_form, @invitation.invitation_id)) %> to create your account. The link is valid for 48 hours after this email is sent.

Plausible is a lightweight and open-source website analytics tool. We hope you like our simple and ethical approach to tracking website visitors. diff --git a/lib/plausible_web/templates/email/over_limit.html.eex b/lib/plausible_web/templates/email/over_limit.html.eex index 3ac2dc440125..ad0a929c7432 100644 --- a/lib/plausible_web/templates/email/over_limit.html.eex +++ b/lib/plausible_web/templates/email/over_limit.html.eex @@ -1,4 +1,4 @@ -Thanks for being a Plausible Analytics subscriber! +Thanks for being a <%= Plausible.product_name() %> subscriber!

This is a friendly reminder that your traffic has exceeded your subscription tier for two consecutive months. Congrats on all that traffic!

diff --git a/lib/plausible_web/templates/email/ownership_transfer_request.html.eex b/lib/plausible_web/templates/email/ownership_transfer_request.html.eex index 13ce240f5266..4da4185a4aa4 100644 --- a/lib/plausible_web/templates/email/ownership_transfer_request.html.eex +++ b/lib/plausible_web/templates/email/ownership_transfer_request.html.eex @@ -1,4 +1,4 @@ -<%= @invitation.inviter.email %> has requested to transfer the ownership of <%= @invitation.site.domain %> site on Plausible Analytics to you. +<%= @invitation.inviter.email %> has requested to transfer the ownership of <%= @invitation.site.domain %> site on <%= Plausible.product_name() %> to you. <%= if @new_owner_account do %> <%= link("Click here", to: Routes.site_url(PlausibleWeb.Endpoint, :index)) %> to view and respond to the invitation. <% else %> diff --git a/lib/plausible_web/templates/email/yearly_expiration_notification.html.eex b/lib/plausible_web/templates/email/yearly_expiration_notification.html.eex index 403663b18dc1..c2aaeafcac7b 100644 --- a/lib/plausible_web/templates/email/yearly_expiration_notification.html.eex +++ b/lib/plausible_web/templates/email/yearly_expiration_notification.html.eex @@ -1,4 +1,4 @@ -Time flies! This is a reminder that your annual subscription for Plausible Analytics will expire on <%= @next_bill_date %>. +Time flies! This is a reminder that your annual subscription for <%= Plausible.product_name() %> will expire on <%= @next_bill_date %>.

You need to <%= link("renew your subscription", to: PlausibleWeb.Router.Helpers.billing_url(PlausibleWeb.Endpoint, :choose_plan)) %> if you want to continue using Plausible to count your website stats in a privacy-friendly way.

diff --git a/lib/plausible_web/templates/email/yearly_renewal_notification.html.eex b/lib/plausible_web/templates/email/yearly_renewal_notification.html.eex index 220a34313d11..01fb4be76559 100644 --- a/lib/plausible_web/templates/email/yearly_renewal_notification.html.eex +++ b/lib/plausible_web/templates/email/yearly_renewal_notification.html.eex @@ -1,4 +1,4 @@ -Time flies! This is a reminder that your annual subscription for Plausible Analytics is due to renew on <%= @date %>. We will automatically charge <%= PlausibleWeb.BillingView.present_currency(@currency) %><%= @next_bill_amount %> from your preferred billing method. +Time flies! This is a reminder that your annual subscription for <%= Plausible.product_name() %> is due to renew on <%= @date %>. We will automatically charge <%= PlausibleWeb.BillingView.present_currency(@currency) %><%= @next_bill_amount %> from your preferred billing method.

There's no action required if you're happy to continue using Plausible to count your website stats in a privacy-friendly way.

diff --git a/lib/plausible_web/templates/layout/focus.html.heex b/lib/plausible_web/templates/layout/focus.html.heex index 560ad17f5139..9adcb81e03b6 100644 --- a/lib/plausible_web/templates/layout/focus.html.heex +++ b/lib/plausible_web/templates/layout/focus.html.heex @@ -47,9 +47,11 @@ <% end %> <%= @inner_content %> -

- © <%= DateTime.utc_now().year() %> Plausible Analytics. All rights reserved. -

+ <%= if ee?() do %> +

+ © <%= DateTime.utc_now().year() %> Plausible Analytics. All rights reserved. +

+ <% end %> diff --git a/lib/plausible_web/templates/page/index.html.eex b/lib/plausible_web/templates/page/index.html.eex index 9d2b0d79813c..b238a92e0c03 100644 --- a/lib/plausible_web/templates/page/index.html.eex +++ b/lib/plausible_web/templates/page/index.html.eex @@ -1,9 +1,9 @@

- Welcome to Plausible Analytics! + Welcome to <%= Plausible.product_name() %>!

- Plausible Analytics is a simple, open source, lightweight (< 1 KB) and privacy-friendly alternative to Google Analytics. We're completely independent and solely funded by our 10,000+ paying subscribers. Read more about us. + <%= Plausible.product_name() %> is a simple, open source, lightweight (< 1 KB) and privacy-friendly alternative to Google Analytics. We're completely independent and solely funded by our 10,000+ paying subscribers. Read more about us.

  • diff --git a/lib/plausible_web/templates/site/settings_search_console.html.heex b/lib/plausible_web/templates/site/settings_search_console.html.heex index 480da7328274..3a38219f6120 100644 --- a/lib/plausible_web/templates/site/settings_search_console.html.heex +++ b/lib/plausible_web/templates/site/settings_search_console.html.heex @@ -116,7 +116,7 @@

    - An extra step is needed to set up your Plausible Analytics Self Hosted for the Google Search Console integration. + An extra step is needed to set up your <%= Plausible.product_name() %> for the Google Search Console integration. Find instructions <%= link("here", to: "https://plausible.io/docs/self-hosting-configuration#google-search-integration", class: "text-indigo-500" From 64f04efac7a431ddd0cbfc6227dd40df701ab2df Mon Sep 17 00:00:00 2001 From: ruslandoga <67764432+ruslandoga@users.noreply.github.com> Date: Thu, 23 May 2024 13:56:00 +0700 Subject: [PATCH 2/3] update tests --- test/plausible/plausible_test.exs | 15 +++++++++++++++ test/plausible/site/admin_test.exs | 7 +++++-- .../site/memberships/accept_invitation_test.exs | 8 +++++--- .../site/memberships/create_invitation_test.exs | 17 ++++++++++------- .../site/memberships/reject_invitation_test.exs | 5 ++++- .../controllers/page_controller_test.exs | 3 ++- .../site/membership_controller_test.exs | 17 ++++++++++------- 7 files changed, 51 insertions(+), 21 deletions(-) create mode 100644 test/plausible/plausible_test.exs diff --git a/test/plausible/plausible_test.exs b/test/plausible/plausible_test.exs new file mode 100644 index 000000000000..d388ba1ad96f --- /dev/null +++ b/test/plausible/plausible_test.exs @@ -0,0 +1,15 @@ +defmodule PlausibleTest do + use ExUnit.Case, async: true + + describe "product_name/0" do + @tag :ce_build_only + test "returns the correct name in CE" do + assert Plausible.product_name() == "Plausible CE" + end + + @tag :ee_only + test "returns the correct name in EE" do + assert Plausible.product_name() == "Plausible Analytics" + end + end +end diff --git a/test/plausible/site/admin_test.exs b/test/plausible/site/admin_test.exs index 136f54bfe440..939b2a628bf8 100644 --- a/test/plausible/site/admin_test.exs +++ b/test/plausible/site/admin_test.exs @@ -1,7 +1,10 @@ defmodule Plausible.Site.AdminTest do + use Plausible use Plausible.DataCase, async: true use Bamboo.Test + @subject_prefix if ee?(), do: "[Plausible Analytics] ", else: "[Plausible CE] " + setup do admin_user = insert(:user) conn = %Plug.Conn{assigns: %{current_user: admin_user}} @@ -56,12 +59,12 @@ defmodule Plausible.Site.AdminTest do assert_email_delivered_with( to: [nil: new_owner.email], - subject: "[Plausible Analytics] Request to transfer ownership of #{site1.domain}" + subject: @subject_prefix <> "Request to transfer ownership of #{site1.domain}" ) assert_email_delivered_with( to: [nil: new_owner.email], - subject: "[Plausible Analytics] Request to transfer ownership of #{site2.domain}" + subject: @subject_prefix <> "Request to transfer ownership of #{site2.domain}" ) end end diff --git a/test/plausible/site/memberships/accept_invitation_test.exs b/test/plausible/site/memberships/accept_invitation_test.exs index f9e2a4a3eaa5..a0123973d3a8 100644 --- a/test/plausible/site/memberships/accept_invitation_test.exs +++ b/test/plausible/site/memberships/accept_invitation_test.exs @@ -6,6 +6,8 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do alias Plausible.Site.Memberships.AcceptInvitation + @subject_prefix if ee?(), do: "[Plausible Analytics] ", else: "[Plausible CE] " + describe "transfer_ownership/3" do test "transfers ownership successfully" do site = insert(:site, memberships: []) @@ -210,8 +212,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do assert_email_delivered_with( to: [nil: inviter.email], - subject: - "[Plausible Analytics] #{invitee.email} accepted your invitation to #{site.domain}" + subject: @subject_prefix <> "#{invitee.email} accepted your invitation to #{site.domain}" ) end @@ -311,7 +312,8 @@ defmodule Plausible.Site.Memberships.AcceptInvitationTest do assert_email_delivered_with( to: [nil: existing_owner.email], subject: - "[Plausible Analytics] #{new_owner.email} accepted the ownership transfer of #{site.domain}" + @subject_prefix <> + "#{new_owner.email} accepted the ownership transfer of #{site.domain}" ) end diff --git a/test/plausible/site/memberships/create_invitation_test.exs b/test/plausible/site/memberships/create_invitation_test.exs index 92506b0942b4..cb8490f55524 100644 --- a/test/plausible/site/memberships/create_invitation_test.exs +++ b/test/plausible/site/memberships/create_invitation_test.exs @@ -1,8 +1,11 @@ defmodule Plausible.Site.Memberships.CreateInvitationTest do alias Plausible.Site.Memberships.CreateInvitation + use Plausible use Plausible.DataCase use Bamboo.Test + @subject_prefix if ee?(), do: "[Plausible Analytics] ", else: "[Plausible CE] " + describe "create_invitation/4" do test "creates an invitation" do inviter = insert(:user) @@ -49,7 +52,7 @@ defmodule Plausible.Site.Memberships.CreateInvitationTest do assert_email_delivered_with( to: [nil: invitee.email], - subject: "[Plausible Analytics] You've been invited to #{site.domain}" + subject: @subject_prefix <> "You've been invited to #{site.domain}" ) end @@ -62,7 +65,7 @@ defmodule Plausible.Site.Memberships.CreateInvitationTest do assert_email_delivered_with( to: [nil: "vini@plausible.test"], - subject: "[Plausible Analytics] You've been invited to #{site.domain}" + subject: @subject_prefix <> "You've been invited to #{site.domain}" ) end @@ -143,7 +146,7 @@ defmodule Plausible.Site.Memberships.CreateInvitationTest do assert_email_delivered_with( to: [nil: "vini@plausible.test"], - subject: "[Plausible Analytics] Request to transfer ownership of #{site.domain}" + subject: @subject_prefix <> "Request to transfer ownership of #{site.domain}" ) end @@ -261,7 +264,7 @@ defmodule Plausible.Site.Memberships.CreateInvitationTest do assert_email_delivered_with( to: [nil: new_owner.email], - subject: "[Plausible Analytics] Request to transfer ownership of #{site1.domain}" + subject: @subject_prefix <> "Request to transfer ownership of #{site1.domain}" ) assert Repo.exists?( @@ -275,7 +278,7 @@ defmodule Plausible.Site.Memberships.CreateInvitationTest do assert_email_delivered_with( to: [nil: new_owner.email], - subject: "[Plausible Analytics] Request to transfer ownership of #{site2.domain}" + subject: @subject_prefix <> "Request to transfer ownership of #{site2.domain}" ) assert_invitation_exists(site2, new_owner.email, :owner) @@ -299,7 +302,7 @@ defmodule Plausible.Site.Memberships.CreateInvitationTest do assert_email_delivered_with( to: [nil: new_owner.email], - subject: "[Plausible Analytics] Request to transfer ownership of #{site1.domain}" + subject: @subject_prefix <> "Request to transfer ownership of #{site1.domain}" ) assert Repo.exists?( @@ -313,7 +316,7 @@ defmodule Plausible.Site.Memberships.CreateInvitationTest do assert_email_delivered_with( to: [nil: new_owner.email], - subject: "[Plausible Analytics] Request to transfer ownership of #{site2.domain}" + subject: @subject_prefix <> "Request to transfer ownership of #{site2.domain}" ) assert_invitation_exists(site2, new_owner.email, :owner) diff --git a/test/plausible/site/memberships/reject_invitation_test.exs b/test/plausible/site/memberships/reject_invitation_test.exs index f6149c00dd03..b7b0aaa5c6d0 100644 --- a/test/plausible/site/memberships/reject_invitation_test.exs +++ b/test/plausible/site/memberships/reject_invitation_test.exs @@ -1,7 +1,10 @@ defmodule Plausible.Site.Memberships.RejectInvitationTest do + use Plausible use Plausible.DataCase, async: true use Bamboo.Test + @subject_prefix if ee?(), do: "[Plausible Analytics] ", else: "[Plausible CE] " + alias Plausible.Site.Memberships.RejectInvitation test "rejects invitation and sends email to inviter" do @@ -25,7 +28,7 @@ defmodule Plausible.Site.Memberships.RejectInvitationTest do assert_email_delivered_with( to: [nil: inviter.email], - subject: "[Plausible Analytics] #{invitee.email} rejected your invitation to #{site.domain}" + subject: @subject_prefix <> "#{invitee.email} rejected your invitation to #{site.domain}" ) end diff --git a/test/plausible_web/controllers/page_controller_test.exs b/test/plausible_web/controllers/page_controller_test.exs index b4c390a0f0be..afaf587f18c1 100644 --- a/test/plausible_web/controllers/page_controller_test.exs +++ b/test/plausible_web/controllers/page_controller_test.exs @@ -4,8 +4,9 @@ defmodule PlausibleWeb.PageControllerTest do setup {PlausibleWeb.FirstLaunchPlug.Test, :skip} describe "GET /" do + @tag :ce_build_only test "shows landing page when user not authenticated", %{conn: conn} do - assert conn |> get("/") |> html_response(200) =~ "Welcome to Plausible Analytics!" + assert conn |> get("/") |> html_response(200) =~ "Welcome to Plausible CE!" end test "redirects to /sites if user is authenticated", %{conn: conn} do diff --git a/test/plausible_web/controllers/site/membership_controller_test.exs b/test/plausible_web/controllers/site/membership_controller_test.exs index 4f7332a52c07..33402bd4b3aa 100644 --- a/test/plausible_web/controllers/site/membership_controller_test.exs +++ b/test/plausible_web/controllers/site/membership_controller_test.exs @@ -1,10 +1,13 @@ defmodule PlausibleWeb.Site.MembershipControllerTest do + use Plausible use PlausibleWeb.ConnCase use Plausible.Repo use Bamboo.Test import Plausible.Test.Support.HTML + @subject_prefix if ee?(), do: "[Plausible Analytics] ", else: "[Plausible CE] " + setup [:create_user, :log_in] describe "GET /sites/:website/memberships/invite" do @@ -115,7 +118,7 @@ defmodule PlausibleWeb.Site.MembershipControllerTest do assert_email_delivered_with( to: [nil: "john.doe@example.com"], - subject: "[Plausible Analytics] You've been invited to #{site.domain}" + subject: @subject_prefix <> "You've been invited to #{site.domain}" ) end @@ -130,7 +133,7 @@ defmodule PlausibleWeb.Site.MembershipControllerTest do assert_email_delivered_with( to: [nil: existing_user.email], - subject: "[Plausible Analytics] You've been invited to #{site.domain}" + subject: @subject_prefix <> "You've been invited to #{site.domain}" ) end @@ -168,7 +171,7 @@ defmodule PlausibleWeb.Site.MembershipControllerTest do assert_email_delivered_with( to: [nil: "joe@example.com"], - subject: "[Plausible Analytics] You've been invited to #{site.domain}" + subject: @subject_prefix <> "You've been invited to #{site.domain}" ) req2 = @@ -179,7 +182,7 @@ defmodule PlausibleWeb.Site.MembershipControllerTest do refute_email_delivered_with( to: [nil: "joe@example.com"], - subject: "[Plausible Analytics] You've been invited to #{site.domain}" + subject: @subject_prefix <> "You've been invited to #{site.domain}" ) assert people_settings = redirected_to(req2, 302) @@ -226,7 +229,7 @@ defmodule PlausibleWeb.Site.MembershipControllerTest do assert_email_delivered_with( to: [nil: "john.doe@example.com"], - subject: "[Plausible Analytics] Request to transfer ownership of #{site.domain}" + subject: @subject_prefix <> "Request to transfer ownership of #{site.domain}" ) end @@ -238,7 +241,7 @@ defmodule PlausibleWeb.Site.MembershipControllerTest do assert_email_delivered_with( to: [nil: existing_user.email], - subject: "[Plausible Analytics] Request to transfer ownership of #{site.domain}" + subject: @subject_prefix <> "Request to transfer ownership of #{site.domain}" ) end @@ -478,7 +481,7 @@ defmodule PlausibleWeb.Site.MembershipControllerTest do assert_email_delivered_with( to: [nil: admin.email], - subject: "[Plausible Analytics] Your access to #{site.domain} has been revoked" + subject: @subject_prefix <> "Your access to #{site.domain} has been revoked" ) end end From c25a3c3ddf7ed4f4b7beccecf63f2dd00b354e53 Mon Sep 17 00:00:00 2001 From: ruslandoga <67764432+ruslandoga@users.noreply.github.com> Date: Thu, 23 May 2024 14:09:54 +0700 Subject: [PATCH 3/3] still mention Plausible Analytics on landing page --- lib/plausible_web/templates/page/index.html.eex | 4 ++-- test/plausible_web/controllers/page_controller_test.exs | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/plausible_web/templates/page/index.html.eex b/lib/plausible_web/templates/page/index.html.eex index b238a92e0c03..5104bdf944c9 100644 --- a/lib/plausible_web/templates/page/index.html.eex +++ b/lib/plausible_web/templates/page/index.html.eex @@ -1,9 +1,9 @@

    - Welcome to <%= Plausible.product_name() %>! + Welcome to Plausible!

    - <%= Plausible.product_name() %> is a simple, open source, lightweight (< 1 KB) and privacy-friendly alternative to Google Analytics. We're completely independent and solely funded by our 10,000+ paying subscribers. Read more about us. + Plausible Analytics is a simple, open source, lightweight (< 1 KB) and privacy-friendly alternative to Google Analytics. We're completely independent and solely funded by our 10,000+ paying subscribers. Read more about us.

    • diff --git a/test/plausible_web/controllers/page_controller_test.exs b/test/plausible_web/controllers/page_controller_test.exs index afaf587f18c1..b1642112944b 100644 --- a/test/plausible_web/controllers/page_controller_test.exs +++ b/test/plausible_web/controllers/page_controller_test.exs @@ -4,9 +4,8 @@ defmodule PlausibleWeb.PageControllerTest do setup {PlausibleWeb.FirstLaunchPlug.Test, :skip} describe "GET /" do - @tag :ce_build_only test "shows landing page when user not authenticated", %{conn: conn} do - assert conn |> get("/") |> html_response(200) =~ "Welcome to Plausible CE!" + assert conn |> get("/") |> html_response(200) =~ "Welcome to Plausible!" end test "redirects to /sites if user is authenticated", %{conn: conn} do