Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.
TypeScript analyticsanalytics-dashboardclickhouseelixirgoogle-analyticsmarketingopen-source-analyticsphoenixplausible-analyticspostgresqlprivacyprivacy-friendlyself-hostedsimple-analyticsstatisticstailwindcssweb-analyticswebsite-analyticswebsite-statswebsite-tracking
CS: display only team's sites + rejecting traffic info if applicable (#5400)
hq162da8f115fe9
diff --git a/extra/lib/plausible_web/live/customer_support/live/site.ex b/extra/lib/plausible_web/live/customer_support/live/site.exindex e4ac14d19e..b51bf95c3b 100644--- a/extra/lib/plausible_web/live/customer_support/live/site.ex+++ b/extra/lib/plausible_web/live/customer_support/live/site.ex@@ -40,8 +40,25 @@ defmodule PlausibleWeb.CustomerSupport.Live.Site do</div><div>- <p class="text-xl font-bold sm:text-2xl">+ <p class="text-xl font-bold sm:text-2xl flex items-center gap-x-2">{@site.domain}++ <span+ :if={+ @site.team.accept_traffic_until &&+ Date.after?(Date.utc_today(), @site.team.accept_traffic_until)+ }+ class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-red-100 text-red-800"+ >+ Rejecting traffic+ </span>++ <span+ :if={@site.ingest_rate_limit_threshold == 0}+ class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-red-100 text-red-800"+ >+ Traffic blocked+ </span></p><p class="text-sm font-medium">Timezone: {@site.timezone}diff --git a/extra/lib/plausible_web/live/customer_support/live/team.ex b/extra/lib/plausible_web/live/customer_support/live/team.exindex 5fe947d539..17a72ff93c 100644--- a/extra/lib/plausible_web/live/customer_support/live/team.ex+++ b/extra/lib/plausible_web/live/customer_support/live/team.ex@@ -29,9 +29,10 @@ defmodule PlausibleWeb.CustomerSupport.Live.Team doenddef update(%{tab: "sites"}, %{assigns: %{team: team}} = socket) do- any_owner = Plausible.Repo.preload(team, [:owners]).owners |> hd()- sites = Teams.Sites.list(any_owner, %{}, team: team)- {:ok, assign(socket, sites: sites, tab: "sites")}+ sites = Teams.owned_sites(team, 100)+ sites_count = Teams.owned_sites_count(team)++ {:ok, assign(socket, sites: sites, sites_count: sites_count, tab: "sites")}enddef update(%{tab: "billing"}, %{assigns: %{team: team}} = socket) do@@ -363,7 +364,10 @@ defmodule PlausibleWeb.CustomerSupport.Live.Team do</div><div :if={@tab == "sites"} class="mt-2">- <.table rows={@sites.entries}>+ <.notice :if={@sites_count > 100} class="mt-4 mb-4">+ This team owns more than 100 sites. Displaying first 100 below.+ </.notice>+ <.table rows={@sites}><:thead><.th>Domain</.th><.th>Previous Domain</.th>diff --git a/lib/plausible/teams.ex b/lib/plausible/teams.exindex e1a57b3be5..0b70d2dbe8 100644--- a/lib/plausible/teams.ex+++ b/lib/plausible/teams.ex@@ -88,6 +88,10 @@ defmodule Plausible.Teams doRepo.preload(team, :sites).sitesend+ def owned_sites(team, limit) when is_integer(limit) do+ Repo.preload(team, sites: from(s in Plausible.Site, limit: ^limit, order_by: [asc: s.domain])).sites+ end+def owned_sites_ids(nil) do[]end