Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/plausible_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,7 @@ defmodule PlausibleWeb.Router do
put "/:domain/settings", SiteController, :update_settings

get "/:domain/export", StatsController, :csv_export
get "/:domain", StatsController, :stats
get "/:domain/*path", StatsController, :stats
end
end
Expand Down
8 changes: 4 additions & 4 deletions test/plausible_web/components/billing/billing_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ defmodule PlausibleWeb.Components.BillingTest do
)

assert element_exists?(html, "[data-test-id='total-pageviews-dashboard-link']")
assert html =~ "/my-site.example.com/?period=custom"
assert html =~ "/my-site.example.com?period=custom"
end

test "renders no total link when no domain is provided" do
Expand All @@ -354,8 +354,8 @@ defmodule PlausibleWeb.Components.BillingTest do

html = render_monthly_pageview_usage(usage, 10_000)

assert html =~ "/example.com/?period=custom"
assert html =~ "/app.example.com/?period=custom"
assert html =~ "/example.com?period=custom"
assert html =~ "/app.example.com?period=custom"
end

test "dashboard links include the billing cycle date range" do
Expand All @@ -367,7 +367,7 @@ defmodule PlausibleWeb.Components.BillingTest do
)

assert html =~
"/my-site.example.com/?period=custom&from=2024-01-01&to=2024-01-31"
"/my-site.example.com?period=custom&from=2024-01-01&to=2024-01-31"
end
end

Expand Down
13 changes: 8 additions & 5 deletions test/plausible_web/controllers/invitation_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ defmodule PlausibleWeb.Site.InvitationControllerTest do
assert Phoenix.Flash.get(conn.assigns.flash, :success) ==
"You now have access to #{site.domain}"

assert redirected_to(conn) == "/#{URI.encode_www_form(site.domain)}/"
assert redirected_to(conn) == Routes.stats_path(PlausibleWeb.Endpoint, :stats, site.domain)

refute Repo.exists?(from(i in Plausible.Teams.Invitation, where: i.email == ^user.email))

Expand Down Expand Up @@ -53,7 +53,7 @@ defmodule PlausibleWeb.Site.InvitationControllerTest do
invitation = invite_guest(site, user.email, role: :editor, inviter: owner)

c1 = post(conn, "/sites/invitations/#{invitation.invitation_id}/accept")
assert redirected_to(c1) == "/#{URI.encode_www_form(site.domain)}/"
assert redirected_to(c1) == Routes.stats_path(PlausibleWeb.Endpoint, :stats, site.domain)

assert Phoenix.Flash.get(c1.assigns.flash, :success) ==
"You now have access to #{site.domain}"
Expand All @@ -78,7 +78,8 @@ defmodule PlausibleWeb.Site.InvitationControllerTest do

conn = post(conn, "/sites/invitations/#{transfer.transfer_id}/accept")

assert redirected_to(conn, 302) == "/#{URI.encode_www_form(site.domain)}/"
assert redirected_to(conn, 302) ==
Routes.stats_path(PlausibleWeb.Endpoint, :stats, site.domain)

assert Phoenix.Flash.get(conn.assigns.flash, :success) =~
"You now have access to"
Expand Down Expand Up @@ -140,7 +141,8 @@ defmodule PlausibleWeb.Site.InvitationControllerTest do

conn = post(conn, "/sites/invitations/#{transfer.transfer_id}/accept")

assert redirected_to(conn, 302) == "/#{URI.encode_www_form(site.domain)}/"
assert redirected_to(conn, 302) ==
Routes.stats_path(PlausibleWeb.Endpoint, :stats, site.domain)

assert Phoenix.Flash.get(conn.assigns.flash, :success) =~
"You now have access to"
Expand Down Expand Up @@ -208,7 +210,8 @@ defmodule PlausibleWeb.Site.InvitationControllerTest do
"/sites/invitations/#{transfer.transfer_id}/accept?skip_site_members_transfer=true"
)

assert redirected_to(conn, 302) == "/#{URI.encode_www_form(site.domain)}/"
assert redirected_to(conn, 302) ==
Routes.stats_path(PlausibleWeb.Endpoint, :stats, site.domain)

assert Phoenix.Flash.get(conn.assigns.flash, :success) =~
"You now have access to"
Expand Down
2 changes: 1 addition & 1 deletion test/plausible_web/controllers/site_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ defmodule PlausibleWeb.SiteControllerTest do
}
})

assert redirected_to(conn) == "/example.com/"
assert redirected_to(conn) == "/example.com"
end
end

Expand Down
5 changes: 4 additions & 1 deletion test/plausible_web/live/customer_support/sites_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ defmodule PlausibleWeb.Live.CustomerSupport.SitesTest do
~s|a[href$="#{URI.encode_www_form(site.domain)}/settings/general"]|
)

assert element_exists?(html, ~s|a[href="/#{URI.encode_www_form(site.domain)}/"]|)
assert element_exists?(
html,
~s|a[href="#{Routes.stats_path(PlausibleWeb.Endpoint, :stats, site.domain)}"]|
)
end

test "404", %{conn: conn} do
Expand Down
2 changes: 1 addition & 1 deletion test/plausible_web/live/customer_support/teams_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ defmodule PlausibleWeb.Live.CustomerSupport.TeamsTest do
html = render(lv)
text = text(html)

assert element_exists?(html, ~s|a[href="/primary.example.com%2Ftest/"]|)
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"
Expand Down
4 changes: 2 additions & 2 deletions test/plausible_web/live/verification_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ defmodule PlausibleWeb.Live.VerificationTest do
build(:pageview)
])

assert_redirect(lv, "/#{URI.encode_www_form(site.domain)}/")
assert_redirect(lv, Routes.stats_path(PlausibleWeb.Endpoint, :stats, site.domain))
end

@tag :ce_build_only
Expand All @@ -207,7 +207,7 @@ defmodule PlausibleWeb.Live.VerificationTest do

populate_stats(site, [build(:pageview)])

assert_redirect(lv, "/#{URI.encode_www_form(site.domain)}/")
assert_redirect(lv, Routes.stats_path(PlausibleWeb.Endpoint, :stats, site.domain))
end

for {installation_type_param, expected_text, saved_installation_type} <- [
Expand Down
Loading