diff --git a/lib/plausible_web/templates/email/weekly_report.html.eex b/lib/plausible_web/templates/email/weekly_report.html.eex index 0afc7a407..be6ae610b 100644 --- a/lib/plausible_web/templates/email/weekly_report.html.eex +++ b/lib/plausible_web/templates/email/weekly_report.html.eex @@ -609,7 +609,7 @@ body {
<%= if @login_link do %> - + Login to view your dashboard diff --git a/lib/workers/send_email_report.ex b/lib/workers/send_email_report.ex index fda661120..72ee4465c 100644 --- a/lib/workers/send_email_report.ex +++ b/lib/workers/send_email_report.ex @@ -46,12 +46,6 @@ defmodule Plausible.Workers.SendEmailReport do :ok end - defp gen_login_link("Weekly"), - do: PlausibleWeb.Endpoint.url() <> "/login?utm_medium=email&utm_source=weekly-report" - - defp gen_login_link(_), - do: PlausibleWeb.Endpoint.url() <> "/login?utm_medium=email&utm_source=monthly-report" - defp send_report(email, site, name, unsubscribe_link, query) do {pageviews, unique_visitors} = Stats.pageviews_and_visitors(site, query) @@ -64,7 +58,7 @@ defmodule Plausible.Workers.SendEmailReport do referrers = Stats.top_sources(site, query, 5, 1, []) pages = Stats.top_pages(site, query, 5, 1, []) user = Plausible.Auth.find_user_by(email: email) - login_link = user && Plausible.Sites.is_owner?(user.id, site) && gen_login_link(name) + login_link = user && Plausible.Sites.is_owner?(user.id, site) template = PlausibleWeb.Email.weekly_report(email, site, @@ -79,8 +73,7 @@ defmodule Plausible.Workers.SendEmailReport do login_link: login_link, pages: pages, query: query, - name: name, - login_link: login_link + name: name ) try do diff --git a/test/workers/send_email_report_test.exs b/test/workers/send_email_report_test.exs index 2db827e32..21c1b5c8e 100644 --- a/test/workers/send_email_report_test.exs +++ b/test/workers/send_email_report_test.exs @@ -25,19 +25,6 @@ defmodule Plausible.Workers.SendEmailReportTest do to: [nil: "user2@email.com"] ) end - - test "includes correct login link in email" do - user = insert(:user) - site = insert(:site, domain: "test-site.com", timezone: "US/Eastern", members: [user]) - insert(:weekly_report, site: site, recipients: [user.email]) - - perform(%{"site_id" => site.id, "interval" => "weekly"}) - - user_email = user.email - assert_delivered_email_matches(%{to: [{_, ^user_email}], html_body: html_body}) - - assert html_body =~ "/login?utm_medium=email&utm_source=weekly-report" - end end describe "monthly_reports" do @@ -63,18 +50,5 @@ defmodule Plausible.Workers.SendEmailReportTest do to: [nil: "user2@email.com"] ) end - - test "includes correct login link in email" do - user = insert(:user) - site = insert(:site, domain: "test-site.com", timezone: "US/Eastern", members: [user]) - insert(:monthly_report, site: site, recipients: [user.email]) - - perform(%{"site_id" => site.id, "interval" => "monthly"}) - - user_email = user.email - assert_delivered_email_matches(%{to: [{_, ^user_email}], html_body: html_body}) - - assert html_body =~ "/login?utm_medium=email&utm_source=monthly-report" - end end end