Don't access remote events from non-federated instances when not logged

in

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-02-07 16:28:49 +01:00
parent 39017b63a9
commit 94df5bd1be
3 changed files with 48 additions and 5 deletions

View File

@@ -140,6 +140,7 @@ defmodule Mobilizon.Config do
]
def anonymous_actor_id, do: get_cached_value(:anonymous_actor_id)
def relay_actor_id, do: get_cached_value(:relay_actor_id)
@spec get(module | atom) :: any
def get(key), do: get(key, nil)
@@ -202,6 +203,13 @@ defmodule Mobilizon.Config do
end
end
@spec create_cache(atom()) :: integer()
defp create_cache(:relay_actor_id) do
with {:ok, %Actor{id: actor_id}} <- Actors.get_or_create_internal_actor("relay") do
actor_id
end
end
def clear_config_cache do
Cachex.clear(:config)
end