Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Add notice about whether a subscription is yearly

Uku Taht65ac83f2ff4c
diff --git a/lib/plausible_web/email.ex b/lib/plausible_web/email.ex
index f1468a767b..44244dc135 100644
--- a/lib/plausible_web/email.ex
+++ b/lib/plausible_web/email.ex
@@ -113,11 +113,23 @@ defmodule PlausibleWeb.Email do
end
def over_limit_email(user, usage, last_cycle) do
+ yearly_plan_ids =
+ Plausible.Billing.Plans.plans()
+ |> Map.fetch!(:yearly)
+ |> Enum.map(fn {_limit, plan} -> plan[:product_id] end)
+
+ subject_pre =
+ if user.subscription.paddle_plan_id in yearly_plan_ids do
+ "[YEARLY] "
+ else
+ ""
+ end
+
base_email()
# Temporary testing
|> to(["[email protected]"])
|> tag("over-limit")
- |> subject("You have outgrown your Plausible subscription tier ")
+ |> subject("#{subject_pre}You have outgrown your Plausible subscription tier ")
|> render("over_limit.html", %{
user: user,
usage: usage,