forked from potsda.mn/mobilizon
fix(activitypub): refresh NodeInfo metadata straight away when adding a new instance to follow
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
6d2f08f3c1
commit
2f4b8feeba
|
@ -16,6 +16,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Admin do
|
||||||
alias Mobilizon.Reports.{Note, Report}
|
alias Mobilizon.Reports.{Note, Report}
|
||||||
alias Mobilizon.Service.Auth.Authenticator
|
alias Mobilizon.Service.Auth.Authenticator
|
||||||
alias Mobilizon.Service.Statistics
|
alias Mobilizon.Service.Statistics
|
||||||
|
alias Mobilizon.Service.Workers.RefreshInstances
|
||||||
alias Mobilizon.Storage.Page
|
alias Mobilizon.Storage.Page
|
||||||
alias Mobilizon.Users.User
|
alias Mobilizon.Users.User
|
||||||
alias Mobilizon.Web.Email
|
alias Mobilizon.Web.Email
|
||||||
|
@ -546,6 +547,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Admin do
|
||||||
case Relay.follow(domain) do
|
case Relay.follow(domain) do
|
||||||
{:ok, _activity, _follow} ->
|
{:ok, _activity, _follow} ->
|
||||||
Instances.refresh()
|
Instances.refresh()
|
||||||
|
RefreshInstances.refresh_instance_actor(domain)
|
||||||
get_instance(parent, args, resolution)
|
get_instance(parent, args, resolution)
|
||||||
|
|
||||||
{:error, :follow_pending} ->
|
{:error, :follow_pending} ->
|
||||||
|
|
|
@ -20,21 +20,16 @@ defmodule Mobilizon.Service.Workers.RefreshInstances do
|
||||||
Instances.refresh()
|
Instances.refresh()
|
||||||
|
|
||||||
Instances.all_domains()
|
Instances.all_domains()
|
||||||
|> Enum.each(&refresh_instance_actor/1)
|
|> Enum.each(fn %Instance{domain: domain} -> refresh_instance_actor(domain) end)
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec refresh_instance_actor(Instance.t()) ::
|
@spec refresh_instance_actor(String.t() | nil) ::
|
||||||
{:ok, Mobilizon.Actors.Actor.t()}
|
{:ok, Mobilizon.Actors.Actor.t()} | {:error, Ecto.Changeset.t()} | {:error, atom}
|
||||||
| {:error,
|
def refresh_instance_actor(nil) do
|
||||||
ActivityPubActor.make_actor_errors()
|
|
||||||
| Mobilizon.Federation.WebFinger.finger_errors()}
|
|
||||||
def refresh_instance_actor(%Instance{domain: nil}) do
|
|
||||||
{:error, :not_remote_instance}
|
{:error, :not_remote_instance}
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec refresh_instance_actor(Instance.t()) ::
|
def refresh_instance_actor(domain) do
|
||||||
{:ok, InstanceActor.t()} | {:error, Ecto.Changeset.t()} | {:error, atom}
|
|
||||||
def refresh_instance_actor(%Instance{domain: domain}) do
|
|
||||||
%Actor{url: url} = Relay.get_actor()
|
%Actor{url: url} = Relay.get_actor()
|
||||||
%URI{host: host} = URI.new!(url)
|
%URI{host: host} = URI.new!(url)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue