From 5630063955aac547a73b8b3e1d0b87afba5d6b44 Mon Sep 17 00:00:00 2001 From: ruslandoga <67764432+ruslandoga@users.noreply.github.com> Date: Sat, 31 Aug 2024 10:20:16 +0700 Subject: [PATCH 1/2] adapt site_setup_success email for ce --- .../templates/email/site_setup_success_email.html.eex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/plausible_web/templates/email/site_setup_success_email.html.eex b/lib/plausible_web/templates/email/site_setup_success_email.html.eex index 3b1958a7ee93..274b303a07ca 100644 --- a/lib/plausible_web/templates/email/site_setup_success_email.html.eex +++ b/lib/plausible_web/templates/email/site_setup_success_email.html.eex @@ -4,10 +4,10 @@ Do check out your <%= link("easy to use, fast-loading and privacy-friendly dashb

Something looks off? Take a look at our <%= link("installation troubleshooting guide", to: "https://plausible.io/docs/troubleshoot-integration") %>.

-<%= if Plausible.Users.on_trial?(@user) do %> - You're on a 30-day free trial with no obligations so do take your time to explore Plausible. Here's how to get <%= link("the most out of your Plausible experience", to: "https://plausible.io/docs/your-plausible-experience") %>. +<%= if not Plausible.ce?() and Plausible.Users.on_trial?(@user) do %> + You're on a 30-day free trial with no obligations so do take your time to explore Plausible. Here's how to get <%= link("the most out of your Plausible experience", to: "https://plausible.io/docs/your-plausible-experience") %>.

<% end %> PS: You can import your historical Google Analytics stats into your Plausible dashboard. <%= link("Learn how our GA importer works", to: "https://plausible.io/docs/google-analytics-import") %>.

-Do reply back to this email if you have any questions. We're here to help. +<%= unless Plausible.ce?() do %>Do reply back to this email if you have any questions. We're here to help.<% end %> From b12563cf2fb34af67309d3ae4df31e381b91351c Mon Sep 17 00:00:00 2001 From: ruslandoga <67764432+ruslandoga@users.noreply.github.com> Date: Mon, 2 Sep 2024 15:22:03 +0700 Subject: [PATCH 2/2] add tests --- test/plausible_web/email_test.exs | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/test/plausible_web/email_test.exs b/test/plausible_web/email_test.exs index 984f7f2685f1..5f0b1b3f44df 100644 --- a/test/plausible_web/email_test.exs +++ b/test/plausible_web/email_test.exs @@ -275,6 +275,39 @@ defmodule PlausibleWeb.EmailTest do end end + describe "site_setup_success" do + setup do + trial_user = + build(:user, + id: -1, + subscription: nil, + trial_expiry_date: Date.add(Date.utc_today(), 100) + ) + + site = build(:site, members: [trial_user]) + email = PlausibleWeb.Email.site_setup_success(trial_user, site) + {:ok, email: email} + end + + @tag :ee_only + test "renders 'trial' and 'reply' blocks", %{email: email} do + assert email.html_body =~ + "You're on a 30-day free trial with no obligations so do take your time to explore Plausible." + + assert email.html_body =~ + "Do reply back to this email if you have any questions. We're here to help." + end + + @tag :ce_build_only + test "does not render 'trial' and 'reply' blocks", %{email: email} do + refute email.html_body =~ + "You're on a 30-day free trial with no obligations so do take your time to explore Plausible." + + refute email.html_body =~ + "Do reply back to this email if you have any questions. We're here to help." + end + end + def plausible_link() do plausible_url = PlausibleWeb.EmailView.plausible_url() "#{plausible_url}"