clear memory cache for instances statistics when appropriate

Add a loading state to buttons InstanceView

Automatically refresh DashboardView data

Fixes #1915
This commit is contained in:
Massedil
2025-12-17 14:15:19 +01:00
parent 33e0d13b4e
commit 2c0adc8670
5 changed files with 102 additions and 68 deletions

View File

@@ -608,6 +608,8 @@ defmodule Mobilizon.GraphQL.Resolvers.Admin do
def remove_relay(_parent, %{address: address}, %{context: %{current_user: %User{role: role}}})
when is_admin(role) do
with {:ok, _activity, follow} <- Relay.unfollow(address) do
Statistics.clear_cached_value(:instance_followers)
Statistics.clear_cached_value(:instance_followings)
{:ok, follow}
end
end
@@ -621,6 +623,8 @@ defmodule Mobilizon.GraphQL.Resolvers.Admin do
)
when is_admin(role) do
with {:ok, _activity, follow} <- Relay.accept(address) do
Statistics.clear_cached_value(:instance_followers)
Statistics.clear_cached_value(:instance_followings)
{:ok, follow}
end
end
@@ -634,6 +638,8 @@ defmodule Mobilizon.GraphQL.Resolvers.Admin do
)
when is_admin(role) do
with {:ok, _activity, follow} <- Relay.reject(address) do
Statistics.clear_cached_value(:instance_followers)
Statistics.clear_cached_value(:instance_followings)
{:ok, follow}
end
end