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
CRM: allow searching sites by `domain_changed_from` (#5918)
Adam Rutkowski8a7d681c4332
diff --git a/extra/lib/plausible/customer_support/resource/site.ex b/extra/lib/plausible/customer_support/resource/site.exindex 5320073839..fb65bd3f4f 100644--- a/extra/lib/plausible/customer_support/resource/site.ex+++ b/extra/lib/plausible/customer_support/resource/site.ex@@ -36,9 +36,11 @@ defmodule Plausible.CustomerSupport.Resource.Site doinner_join: o in assoc(t, :owners),where:ilike(s.domain, ^"%#{input}%") or ilike(t.name, ^"%#{input}%") or- ilike(o.name, ^"%#{input}%") or ilike(o.email, ^"%#{input}%"),+ ilike(o.name, ^"%#{input}%") or ilike(o.email, ^"%#{input}%") or+ ilike(s.domain_changed_from, ^"%#{input}%"),order_by: [desc: fragment("?.domain = ?", s, ^input),+ desc: fragment("?.domain_changed_from = ?", s, ^input),desc: fragment("?.name = ?", t, ^input),desc: fragment("?.name = ?", o, ^input),desc: fragment("?.email = ?", o, ^input),diff --git a/test/plausible_web/live/customer_support_test.exs b/test/plausible_web/live/customer_support_test.exsindex 5a807f9f19..4dc8528a40 100644--- a/test/plausible_web/live/customer_support_test.exs+++ b/test/plausible_web/live/customer_support_test.exs@@ -170,6 +170,19 @@ defmodule PlausibleWeb.Live.CustomerSupportTest dorefute_search_result(html, "team", team1.id)assert_search_result(html, "team", team2.id)end++ test "search sites by domain_changed_from", %{conn: conn, user: user} do+ {:ok, site} =+ new_site(domain: "old.example.com", owner: user)+ |> Plausible.Site.Domain.change("new.example.net")++ {:ok, lv, _html} = live(conn, @cs_index)++ type_into_input(lv, "filter-text", "site:old")+ html = render(lv)++ assert_search_result(html, "site", site.id)+ endenddefp assert_search_result(doc, type, id) do