From 667fe1d2bb1fcf5cc2c2163779fc558e0013dc6f Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Mon, 27 Nov 2023 15:19:27 +0100 Subject: [PATCH] Stop relying on app env --- lib/plausible_web/controllers/stats_controller.ex | 13 +++++-------- .../auth/{activate.html.eex => activate.html.heex} | 6 +++--- ...t.html.eex => google_analytics_import.html.heex} | 2 +- lib/plausible_web/views/email_view.ex | 1 + 4 files changed, 10 insertions(+), 12 deletions(-) rename lib/plausible_web/templates/auth/{activate.html.eex => activate.html.heex} (98%) rename lib/plausible_web/templates/email/{google_analytics_import.html.eex => google_analytics_import.html.heex} (97%) diff --git a/lib/plausible_web/controllers/stats_controller.ex b/lib/plausible_web/controllers/stats_controller.ex index 149ca599d..5b8a5c44d 100644 --- a/lib/plausible_web/controllers/stats_controller.ex +++ b/lib/plausible_web/controllers/stats_controller.ex @@ -363,14 +363,11 @@ defmodule PlausibleWeb.StatsController do end defp is_dbip() do - is_or_nil = - if Application.get_env(:plausible, :is_selfhost) do - if type = Plausible.Geo.database_type() do - String.starts_with?(type, "DBIP") - end - end - - !!is_or_nil + on_full_build do + true + else + String.starts_with?(Plausible.Geo.database_type(), "DBIP") + end end defp title(%{path_info: ["plausible.io"]}, _) do diff --git a/lib/plausible_web/templates/auth/activate.html.eex b/lib/plausible_web/templates/auth/activate.html.heex similarity index 98% rename from lib/plausible_web/templates/auth/activate.html.eex rename to lib/plausible_web/templates/auth/activate.html.heex index 789c97d94..cce619150 100644 --- a/lib/plausible_web/templates/auth/activate.html.eex +++ b/lib/plausible_web/templates/auth/activate.html.heex @@ -27,10 +27,10 @@
  1. Check your spam folder
  2. <%= link("Send a new code", class: "underline text-indigo-600", to: "/activate/request-code", method: :post) %> to <%= @conn.assigns[:current_user].email %>
  3. - <%= if Application.get_env(:plausible, :is_selfhost) do %> -
  4. Ask on our <%= link("community-supported forum", to: "https://github.com/plausible/analytics/discussions", class: "text-indigo-600 underline" ) %>
  5. - <% else %> + <%= if full_build?() do %>
  6. Contact us if the problem persists
  7. + <% else %> +
  8. Ask on our <%= link("community-supported forum", to: "https://github.com/plausible/analytics/discussions", class: "text-indigo-600 underline" ) %>
  9. <% end %>
diff --git a/lib/plausible_web/templates/email/google_analytics_import.html.eex b/lib/plausible_web/templates/email/google_analytics_import.html.heex similarity index 97% rename from lib/plausible_web/templates/email/google_analytics_import.html.eex rename to lib/plausible_web/templates/email/google_analytics_import.html.heex index a99c2f91a..5c3246809 100644 --- a/lib/plausible_web/templates/email/google_analytics_import.html.eex +++ b/lib/plausible_web/templates/email/google_analytics_import.html.heex @@ -27,7 +27,7 @@ If all of the above is fine, please try to do the import once again. Sometimes the Google Analytics API just randomly returns empty data. It's intermittent and random. Trying to do the import again may return what you need. - <%= if !Application.get_env(:plausible, :is_selfhost) do %> + <%= if full_build?() do %>

Please reply to this email to let us know if you're still experiencing issues with the import. <% end %> diff --git a/lib/plausible_web/views/email_view.ex b/lib/plausible_web/views/email_view.ex index 786efb537..e2c6db164 100644 --- a/lib/plausible_web/views/email_view.ex +++ b/lib/plausible_web/views/email_view.ex @@ -1,4 +1,5 @@ defmodule PlausibleWeb.EmailView do + use Plausible use PlausibleWeb, :view def plausible_url do