Skip to content

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

Fix error with anonymous users on shared links

Uku Taht373d05e8def0
diff --git a/lib/plausible_web/views/layout_view.ex b/lib/plausible_web/views/layout_view.ex
index ec2bb57dae..bba14ea7b4 100644
--- a/lib/plausible_web/views/layout_view.ex
+++ b/lib/plausible_web/views/layout_view.ex
@@ -55,11 +55,15 @@ defmodule PlausibleWeb.LayoutView do
end
end
+ def on_grace_period?(nil), do: false
+
def on_grace_period?(user) do
user.grace_period &&
Timex.diff(user.grace_period.end_date, Timex.today(), :days) >= 0
end
+ def grace_period_over?(nil), do: false
+
def grace_period_over?(user) do
user.grace_period &&
Timex.diff(user.grace_period.end_date, Timex.today(), :days) < 0