Pleroma AP detection mechanism.

This commit is contained in:
lain 2018-02-24 13:06:53 +01:00
commit fb02300234
4 changed files with 19 additions and 3 deletions

View file

@ -177,6 +177,13 @@ defmodule Pleroma.Web.OStatus do
end
def maybe_update(doc, user) do
if "true" == string_from_xpath("//author[1]/ap_enabled", doc) do
Transmogrifier.upgrade_user_from_ap_id(user.ap_id)
else
maybe_update_ostatus(doc, user)
end
end
def maybe_update_ostatus(doc, user) do
old_data = %{
avatar: user.avatar,
bio: user.bio,

View file

@ -12,6 +12,12 @@ defmodule Pleroma.Web.OStatus.UserRepresenter do
[]
end
ap_enabled = if user.local do
[{:ap_enabled, ['true']}]
else
[]
end
[
{:id, [ap_id]},
{:"activity:object", ['http://activitystrea.ms/schema/1.0/person']},
@ -22,6 +28,6 @@ defmodule Pleroma.Web.OStatus.UserRepresenter do
{:summary, [bio]},
{:name, [nickname]},
{:link, [rel: 'avatar', href: avatar_url], []}
] ++ banner
] ++ banner ++ ap_enabled
end
end