Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt site_setup_success email for CE #4496

Merged
merged 3 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Do check out your <%= link("easy to use, fast-loading and privacy-friendly dashb
<br /><br />
Something looks off? Take a look at our <%= link("installation troubleshooting guide", to: "https://plausible.io/docs/troubleshoot-integration") %>.
<br /><br />
<%= 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") %>.
<br /><br />
<% 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") %>.
<br /><br />
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 %>
33 changes: 33 additions & 0 deletions test/plausible_web/email_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that 30 days is hardcoded in the template.

)

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()
"<a href=\"#{plausible_url}\">#{plausible_url}</a>"
Expand Down