activitypub transmogrifier: handle hubzilla AP actor quirks

This commit is contained in:
William Pitcock 2018-05-19 07:30:02 +00:00
parent 4d2c6707c2
commit 2051530868
2 changed files with 15 additions and 0 deletions

View file

@ -401,6 +401,8 @@ def user_data_from_user_object(data) do
"url" => [%{"href" => data["image"]["url"]}] "url" => [%{"href" => data["image"]["url"]}]
} }
data = Transmogrifier.maybe_fix_user_object(data)
user_data = %{ user_data = %{
ap_id: data["id"], ap_id: data["id"],
info: %{ info: %{

View file

@ -495,4 +495,17 @@ def maybe_retire_websub(ap_id) do
Repo.delete_all(q) Repo.delete_all(q)
end end
end end
def maybe_fix_user_url(data) do
if is_map(data["url"]) do
data = Map.put(data, "url", data["url"]["href"])
end
data
end
def maybe_fix_user_object(data) do
data
|> maybe_fix_user_url
end
end end