diff --git a/config/.env.test b/config/.env.test index 8fe3862a7..322bcdc60 100644 --- a/config/.env.test +++ b/config/.env.test @@ -23,3 +23,5 @@ S3_REGION=us-east-1 S3_ENDPOINT=http://localhost:10000 S3_EXPORTS_BUCKET=test-exports S3_IMPORTS_BUCKET=test-imports + +VERIFICATION_ENABLED=true diff --git a/lib/plausible/verification.ex b/lib/plausible/verification.ex index 61df2b9af..27ceef29e 100644 --- a/lib/plausible/verification.ex +++ b/lib/plausible/verification.ex @@ -4,14 +4,8 @@ defmodule Plausible.Verification do """ use Plausible - @feature_flag :verification - - def enabled?(user) do - enabled_via_config? = - :plausible |> Application.fetch_env!(__MODULE__) |> Keyword.fetch!(:enabled?) - - enabled_for_user? = not is_nil(user) and FunWithFlags.enabled?(@feature_flag, for: user) - enabled_via_config? or enabled_for_user? + def enabled?() do + :plausible |> Application.fetch_env!(__MODULE__) |> Keyword.fetch!(:enabled?) end on_ee do diff --git a/lib/plausible_web/templates/site/settings_email_reports.html.heex b/lib/plausible_web/templates/site/settings_email_reports.html.heex index 08279318b..f0e3fea9a 100644 --- a/lib/plausible_web/templates/site/settings_email_reports.html.heex +++ b/lib/plausible_web/templates/site/settings_email_reports.html.heex @@ -206,15 +206,13 @@ type: :spike ) %> -<%= if FunWithFlags.enabled?(:traffic_drop_notifications, for: @site) do %> - <%= render("traffic_change_form", - conn: @conn, - notification: @drop_notification, - site: @site, - heading: "Traffic Drop Notifications", - subtitle: "Get notified when your site has unusually low number of visitors within 12 hours", - toggle_text: "Send notifications of traffic drops", - threshold_label: "12 hours visitor threshold", - type: :drop - ) %> -<% end %> +<%= render("traffic_change_form", + conn: @conn, + notification: @drop_notification, + site: @site, + heading: "Traffic Drop Notifications", + subtitle: "Get notified when your site has unusually low number of visitors within 12 hours", + toggle_text: "Send notifications of traffic drops", + threshold_label: "12 hours visitor threshold", + type: :drop +) %> diff --git a/lib/plausible_web/templates/site/settings_general.html.heex b/lib/plausible_web/templates/site/settings_general.html.heex index 5b1728236..122e55418 100644 --- a/lib/plausible_web/templates/site/settings_general.html.heex +++ b/lib/plausible_web/templates/site/settings_general.html.heex @@ -109,7 +109,7 @@ -
+
<%= live_render(@conn, PlausibleWeb.Live.Verification, session: %{ "open_modal?" => !!@conn.params["launch_verification"], diff --git a/lib/plausible_web/templates/site/snippet.html.heex b/lib/plausible_web/templates/site/snippet.html.heex index 729962354..8f4495ef4 100644 --- a/lib/plausible_web/templates/site/snippet.html.heex +++ b/lib/plausible_web/templates/site/snippet.html.heex @@ -7,11 +7,11 @@ <%= form_for @conn, "/", [class: "max-w-lg w-full mx-auto bg-white dark:bg-gray-800 shadow-md rounded px-8 pt-6 pb-8 mb-4 mt-8"], fn f -> %>

Add JavaScript snippet

-

+

Include this snippet in the <head> section of your website.
To verify your integration, click the button below to confirm that everything is working correctly.

-

+

Paste this snippet in the <head> of your website.

@@ -65,7 +65,7 @@

<% button_label = - if Plausible.Verification.enabled?(@current_user) do + if Plausible.Verification.enabled?() do "Verify your integration to start collecting data →" else "Start collecting data →" diff --git a/lib/plausible_web/templates/stats/waiting_first_pageview.html.heex b/lib/plausible_web/templates/stats/waiting_first_pageview.html.heex index 78b0a14fc..86c1b0654 100644 --- a/lib/plausible_web/templates/stats/waiting_first_pageview.html.heex +++ b/lib/plausible_web/templates/stats/waiting_first_pageview.html.heex @@ -22,7 +22,7 @@
<% end %>

Waiting for first pageview

@@ -61,7 +61,7 @@
- <%= if Plausible.Verification.enabled?(assigns[:current_user]), + <%= if Plausible.Verification.enabled?(), do: live_render(@conn, PlausibleWeb.Live.Verification, session: %{ diff --git a/test/test_helper.exs b/test/test_helper.exs index 60cb5701a..d4bef1539 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -1,5 +1,3 @@ -FunWithFlags.enable(:verification) - if not Enum.empty?(Path.wildcard("lib/**/*_test.exs")) do raise "Oops, test(s) found in `lib/` directory. Move them to `test/`." end