Disable searching by member/owner emails in sites and enterprise plan CRMs (temporary) (#4905)

* Disable searching by member/owner emails in sites and enterprise plan CRMs (temporary)

* Make format happy

* Address credo complaint
This commit is contained in:
Adrian Gruntkowski 2024-12-16 13:46:45 +01:00 committed by GitHub
parent fb2e7cda36
commit 1f0b9e9cf3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 5 deletions

View File

@ -12,8 +12,7 @@ defmodule Plausible.Billing.EnterprisePlanAdmin do
def search_fields(_schema) do
[
:paddle_plan_id,
team: [owner: [:name, :email]]
:paddle_plan_id
]
end

View File

@ -9,15 +9,13 @@ defmodule Plausible.SiteAdmin do
def search_fields(_schema) do
[
:domain,
members: [:name, :email]
:domain
]
end
def custom_index_query(_conn, _schema, query) do
from(r in query,
inner_join: o in assoc(r, :owner),
as: :owner,
preload: [owner: o, team: [team_memberships: :user]]
)
end

View File

@ -69,6 +69,20 @@ defmodule PlausibleWeb.AdminController do
end
defp usage_and_limits_html(team, usage, limits, embed?) do
sites =
if team do
Plausible.Repo.preload(team, :sites).sites
else
[]
end
sites_list =
Enum.map_join(sites, "\n", fn site ->
"""
<li><a href="/crm/sites/site/#{site.id}">#{site.domain}</a></li>
"""
end)
content = """
<ul>
<li>Team: <b>#{team && team.name}</b></li>
@ -76,6 +90,13 @@ defmodule PlausibleWeb.AdminController do
<li>Team members: <b>#{usage.team_members}</b> / #{limits.team_members}</li>
<li>Features: #{features_usage(usage.features)}</li>
<li>Monthly pageviews: #{monthly_pageviews_usage(usage.monthly_pageviews, limits.monthly_pageviews)}</li>
<li>
Owned sites:
<ul>
#{sites_list}
</ul>
</li>
</ul>
"""