diff options
author | lain <lain@soykaf.club> | 2021-12-02 16:54:28 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2021-12-02 16:54:28 +0000 |
commit | 235c4139d701f7d25dac2a152d8ab6e4afb1c20d (patch) | |
tree | f16e0089c84728ef8b849bec6b34ca9721e004d9 /lib | |
parent | aaed93db27ea706bab772ea87b4d39e02906d547 (diff) | |
parent | efc28812b8de0d9a6c16d5af1380c6e9c3ef92b1 (diff) | |
download | pleroma-235c4139d701f7d25dac2a152d8ab6e4afb1c20d.tar.gz |
Merge branch 'fix/2782-nodeinfo-active-users' into 'develop'
nodeinfo: report activeMonth and activeHalfyear users fields
Closes #2782
See merge request pleroma/pleroma!3536
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/user.ex | 4 | ||||
-rw-r--r-- | lib/pleroma/web/nodeinfo/nodeinfo.ex | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 3b4e49176..8e40dfc0d 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -2474,8 +2474,8 @@ defmodule Pleroma.User do |> update_and_set_cache() end - def active_user_count(weeks \\ 4) do - active_after = Timex.shift(NaiveDateTime.utc_now(), weeks: -weeks) + def active_user_count(days \\ 30) do + active_after = Timex.shift(NaiveDateTime.utc_now(), days: -days) __MODULE__ |> where([u], u.last_active_at >= ^active_after) diff --git a/lib/pleroma/web/nodeinfo/nodeinfo.ex b/lib/pleroma/web/nodeinfo/nodeinfo.ex index 6a0112d2a..3781781c8 100644 --- a/lib/pleroma/web/nodeinfo/nodeinfo.ex +++ b/lib/pleroma/web/nodeinfo/nodeinfo.ex @@ -35,7 +35,9 @@ defmodule Pleroma.Web.Nodeinfo.Nodeinfo do openRegistrations: Config.get([:instance, :registrations_open]), usage: %{ users: %{ - total: Map.get(stats, :user_count, 0) + total: Map.get(stats, :user_count, 0), + activeMonth: Pleroma.User.active_user_count(30), + activeHalfyear: Pleroma.User.active_user_count(180) }, localPosts: Map.get(stats, :status_count, 0) }, |