Update Instance Actor when updating instance settings

Also fix an issue when publishing activities to followers/group members

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-07-07 15:51:42 +02:00
parent 744c040d0d
commit e0fad9ddd1
8 changed files with 263 additions and 41 deletions

View File

@@ -21,12 +21,14 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Actor do
defdelegate model_to_as(actor), to: ActorConverter
end
@allowed_types ["Application", "Group", "Organization", "Person", "Service"]
@doc """
Converts an AP object data to our internal data structure.
"""
@impl Converter
@spec as_to_model_data(map()) :: {:ok, map()}
def as_to_model_data(data) do
def as_to_model_data(%{"type" => type} = data) when type in @allowed_types do
avatar =
data["icon"]["url"] &&
%{
@@ -62,6 +64,8 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Actor do
}
end
def as_to_model_data(_), do: :error
@doc """
Convert an actor struct to an ActivityStream representation.
"""