Stats: Use invisible property for filtering.

This commit is contained in:
lain 2020-04-22 19:02:22 +02:00
parent 8b88e2a6e2
commit f5bda09de6
2 changed files with 1 additions and 3 deletions

View file

@ -82,8 +82,7 @@ def calculate_stat_data do
where: u.deactivated != true, where: u.deactivated != true,
where: u.local == true, where: u.local == true,
where: not is_nil(u.nickname), where: not is_nil(u.nickname),
where: fragment("? not like 'internal.%'", u.nickname), where: not u.invisible
where: fragment("? not like '%/relay'", u.ap_id)
) )
user_count = Repo.aggregate(users_query, :count, :id) user_count = Repo.aggregate(users_query, :count, :id)

View file

@ -11,7 +11,6 @@ defmodule Pleroma.StatsTest do
test "it ignores internal users" do test "it ignores internal users" do
_user = insert(:user, local: true) _user = insert(:user, local: true)
_internal = insert(:user, local: true, nickname: nil) _internal = insert(:user, local: true, nickname: nil)
_internal = insert(:user, local: true, nickname: "internal.dude")
_internal = Pleroma.Web.ActivityPub.Relay.get_actor() _internal = Pleroma.Web.ActivityPub.Relay.get_actor()
assert match?(%{stats: %{user_count: 1}}, Pleroma.Stats.calculate_stat_data()) assert match?(%{stats: %{user_count: 1}}, Pleroma.Stats.calculate_stat_data())