Skip to content

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

Minor crm fixes (#5863)

Adam Rutkowski49c9cabaed23
diff --git a/extra/lib/plausible_web/live/customer_support/site/components/overview.ex b/extra/lib/plausible_web/live/customer_support/site/components/overview.ex
index 31ee65ff81..c67ee6cb93 100644
--- a/extra/lib/plausible_web/live/customer_support/site/components/overview.ex
+++ b/extra/lib/plausible_web/live/customer_support/site/components/overview.ex
@@ -18,11 +18,17 @@ defmodule PlausibleWeb.CustomerSupport.Site.Components.Overview do
<div class="flex justify-center items-center gap-x-8 pb-8 mb-8 border-b border-gray-200 dark:border-gray-700 w-full text-sm text-center">
<span>Quick links:</span>
- <.styled_link new_tab={true} href={"/#{@site.domain}"}>
+ <.styled_link
+ new_tab={true}
+ href={Routes.stats_path(PlausibleWeb.Endpoint, :stats, @site.domain, [])}
+ >
Dashboard
</.styled_link>
- <.styled_link new_tab={true} href={"/#{@site.domain}/settings/general"}>
+ <.styled_link
+ new_tab={true}
+ href={Routes.site_path(PlausibleWeb.Endpoint, :settings_general, @site.domain, [])}
+ >
Settings
</.styled_link>
diff --git a/lib/plausible/teams/team.ex b/lib/plausible/teams/team.ex
index 5f0591624d..0c0b3862ae 100644
--- a/lib/plausible/teams/team.ex
+++ b/lib/plausible/teams/team.ex
@@ -93,6 +93,7 @@ defmodule Plausible.Teams.Team do
:allow_next_upgrade_override,
:accept_traffic_until
])
+ |> maybe_bump_accept_traffic_until()
end
def changeset(team \\ %__MODULE__{}, attrs \\ %{}, today \\ Date.utc_today()) do
diff --git a/test/plausible_web/live/customer_support/sites_test.exs b/test/plausible_web/live/customer_support/sites_test.exs
index 54a82f386e..2cff615883 100644
--- a/test/plausible_web/live/customer_support/sites_test.exs
+++ b/test/plausible_web/live/customer_support/sites_test.exs
@@ -28,10 +28,10 @@ defmodule PlausibleWeb.Live.CustomerSupport.SitesTest do
assert element_exists?(
html,
- ~s|a[href$="#{site.domain}/settings/general"]|
+ ~s|a[href$="#{URI.encode_www_form(site.domain)}/settings/general"]|
)
- assert element_exists?(html, ~s|a[href="/#{site.domain}"]|)
+ assert element_exists?(html, ~s|a[href="/#{URI.encode_www_form(site.domain)}/"]|)
end
test "404", %{conn: conn} do
diff --git a/test/plausible_web/live/customer_support/teams_test.exs b/test/plausible_web/live/customer_support/teams_test.exs
index 57eb7952e0..7124dde6f3 100644
--- a/test/plausible_web/live/customer_support/teams_test.exs
+++ b/test/plausible_web/live/customer_support/teams_test.exs
@@ -141,6 +141,22 @@ defmodule PlausibleWeb.Live.CustomerSupport.TeamsTest do
assert team.locked
end
+ test "trial expiry date update, updates accept traffic until too", %{conn: conn, user: user} do
+ team = team_of(user)
+ {:ok, lv, _html} = live(conn, open_team(team.id))
+
+ lv
+ |> element("form")
+ |> render_submit(%{
+ "team" => %{"trial_expiry_date" => "2029-01-01"}
+ })
+
+ html = render(lv)
+
+ assert text_of_attr(html, "#team_trial_expiry_date", "value") == "2029-01-01"
+ assert text_of_attr(html, "#team_accept_traffic_until", "value") == "2029-01-15"
+ end
+
test "404", %{conn: conn} do
assert_raise Ecto.NoResultsError, fn ->
{:ok, _lv, _html} = live(conn, open_team(9999))
@@ -157,7 +173,7 @@ defmodule PlausibleWeb.Live.CustomerSupport.TeamsTest do
test "lists sites belonging to a team", %{conn: conn, user: user} do
team = team_of(user)
- new_site(owner: user, domain: "primary.example.com")
+ new_site(owner: user, domain: "primary.example.com/test")
new_site(owner: user, domain: "consolidated.example.com", consolidated: true)
new_site(owner: user, domain: "secondary.example.com")
# other
@@ -167,7 +183,10 @@ defmodule PlausibleWeb.Live.CustomerSupport.TeamsTest do
html = render(lv)
text = text(html)
- assert text =~ "primary.example.com"
+ assert element_exists?(html, ~s|a[href="/primary.example.com%2Ftest/"]|)
+ assert element_exists?(html, ~s|a[href="/primary.example.com%2Ftest/settings/general"]|)
+
+ assert text =~ "primary.example.com/test"
assert text =~ "secondary.example.com"
refute text =~ "condolidated.example.com"
refute text =~ "other.example.com"