Allow to get Mastodon instance relays
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
aff1959030
commit
3982977121
|
@ -469,7 +469,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Admin do
|
|||
})
|
||||
when is_admin(role) do
|
||||
has_relay = Actors.has_relay?(domain)
|
||||
remote_relay = Actors.get_actor_by_name("relay@#{domain}")
|
||||
remote_relay = Actors.get_relay(domain)
|
||||
local_relay = Relay.get_actor()
|
||||
|
||||
result = %{
|
||||
|
|
|
@ -1307,6 +1307,14 @@ defmodule Mobilizon.Actors do
|
|||
|> Repo.exists?()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns a relay actor, either `relay@domain` (Mobilizon) or `domain@domain` (Mastodon)
|
||||
"""
|
||||
@spec get_relay(String.t()) :: Actor.t() | nil
|
||||
def get_relay(domain) do
|
||||
get_actor_by_name("relay@#{domain}") || get_actor_by_name("#{domain}@#{domain}")
|
||||
end
|
||||
|
||||
@spec delete_files_if_media_changed(Ecto.Changeset.t()) :: Ecto.Changeset.t()
|
||||
defp delete_files_if_media_changed(%Ecto.Changeset{changes: changes, data: data} = changeset) do
|
||||
Enum.each([:avatar, :banner], fn key ->
|
||||
|
|
Loading…
Reference in a new issue