Stats: Use `invisible` property for filtering.
authorlain <lain@soykaf.club>
Wed, 22 Apr 2020 17:02:22 +0000 (19:02 +0200)
committerlain <lain@soykaf.club>
Wed, 22 Apr 2020 17:02:22 +0000 (19:02 +0200)
lib/pleroma/stats.ex
test/stats_test.exs

index 6763786a7696a8a7a09332e1585fd8a345446a25..8d2809bbbe546bce9399f069d72f11027da5ba45 100644 (file)
@@ -82,8 +82,7 @@ defmodule Pleroma.Stats do
         where: u.deactivated != true,
         where: u.local == true,
         where: not is_nil(u.nickname),
-        where: fragment("? not like 'internal.%'", u.nickname),
-        where: fragment("? not like '%/relay'", u.ap_id)
+        where: not u.invisible
       )
 
     user_count = Repo.aggregate(users_query, :count, :id)
index 73c7c149510d9c4f119db2987f3cee9b64bc49e3..c1aeb2c7f525871c569ab6aa8f59b93233c33102 100644 (file)
@@ -11,7 +11,6 @@ defmodule Pleroma.StatsTest do
     test "it ignores internal users" do
       _user = insert(:user, local: true)
       _internal = insert(:user, local: true, nickname: nil)
-      _internal = insert(:user, local: true, nickname: "internal.dude")
       _internal = Pleroma.Web.ActivityPub.Relay.get_actor()
 
       assert match?(%{stats: %{user_count: 1}}, Pleroma.Stats.calculate_stat_data())