aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRoger Braun <roger@rogerbraun.net>2017-04-30 12:53:49 +0200
committerRoger Braun <roger@rogerbraun.net>2017-04-30 12:53:49 +0200
commitf9912599c4688a8609bd3500e0548eb2bf06c4a9 (patch)
tree579111228b03115102fd1c786e8cfa1c2c6c5feb /lib
parent18edc299b262974d3acb9d6f9c3758629b2c0968 (diff)
downloadpleroma-f9912599c4688a8609bd3500e0548eb2bf06c4a9.tar.gz
Pull in remote avatar on federation.
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/ostatus/ostatus.ex11
-rw-r--r--lib/pleroma/web/websub/websub.ex4
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/pleroma/web/ostatus/ostatus.ex b/lib/pleroma/web/ostatus/ostatus.ex
index 16b6ac421..01d6745ef 100644
--- a/lib/pleroma/web/ostatus/ostatus.ex
+++ b/lib/pleroma/web/ostatus/ostatus.ex
@@ -39,8 +39,6 @@ defmodule Pleroma.Web.OStatus do
{:ok, activities}
end
- # TODO
- # wire up replies
def handle_note(entry, doc \\ nil) do
content_html = string_from_xpath("/entry/content[1]", entry)
@@ -112,7 +110,8 @@ defmodule Pleroma.Web.OStatus do
name: info.name,
nickname: info.nickname <> "@" <> info.host,
ap_id: info.uri,
- info: info
+ info: info,
+ avatar: info.avatar
}
# TODO: Make remote user changeset
# SHould enforce fqn nickname
@@ -121,9 +120,9 @@ defmodule Pleroma.Web.OStatus do
end
# TODO: Just takes the first one for now.
- defp make_avatar_object(author_doc) do
- href = string_from_xpath("/author[1]/link[@rel=\"avatar\"]/@href", author_doc)
- type = string_from_xpath("/author[1]/link[@rel=\"avatar\"]/@type", author_doc)
+ def make_avatar_object(author_doc) do
+ href = string_from_xpath("/feed/author[1]/link[@rel=\"avatar\"]/@href", author_doc)
+ type = string_from_xpath("/feed/author[1]/link[@rel=\"avatar\"]/@type", author_doc)
if href do
%{
diff --git a/lib/pleroma/web/websub/websub.ex b/lib/pleroma/web/websub/websub.ex
index 3fd779fba..63a91055a 100644
--- a/lib/pleroma/web/websub/websub.ex
+++ b/lib/pleroma/web/websub/websub.ex
@@ -134,13 +134,15 @@ defmodule Pleroma.Web.Websub do
name = XML.string_from_xpath("/feed/author[1]/name", doc)
preferredUsername = XML.string_from_xpath("/feed/author[1]/poco:preferredUsername", doc)
displayName = XML.string_from_xpath("/feed/author[1]/poco:displayName", doc)
+ avatar = OStatus.make_avatar_object(doc)
{:ok, %{
uri: uri,
hub: hub,
nickname: preferredUsername || name,
name: displayName || name,
- host: URI.parse(uri).host
+ host: URI.parse(uri).host,
+ avatar: avatar
}}
else e ->
{:error, e}