X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fstats.ex;h=33f50dda89825f1e0d12b897a64aad430fc3bc59;hb=8854770fc4e9079131a0897d5fb6c0ccccf98bc6;hp=cf590fb0158abedf9d2e80dda0db9d8262a61a65;hpb=29a98b86b7056540ed4102a83dfe6a7e809c2519;p=akkoma
diff --git a/lib/pleroma/stats.ex b/lib/pleroma/stats.ex
index cf590fb01..33f50dda8 100644
--- a/lib/pleroma/stats.ex
+++ b/lib/pleroma/stats.ex
@@ -1,9 +1,10 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Stats do
import Ecto.Query
+ alias Pleroma.CounterCache
alias Pleroma.Repo
alias Pleroma.User
@@ -96,4 +97,21 @@ defmodule Pleroma.Stats do
}
}
end
+
+ def get_status_visibility_count do
+ counter_cache =
+ CounterCache.get_as_map([
+ "status_visibility_public",
+ "status_visibility_private",
+ "status_visibility_unlisted",
+ "status_visibility_direct"
+ ])
+
+ %{
+ public: counter_cache["status_visibility_public"] || 0,
+ unlisted: counter_cache["status_visibility_unlisted"] || 0,
+ private: counter_cache["status_visibility_private"] || 0,
+ direct: counter_cache["status_visibility_direct"] || 0
+ }
+ end
end