Fix remote profile update code.

This commit is contained in:
Roger Braun 2017-09-05 11:40:34 +02:00
parent d1c10ad2fb
commit e9ebfdb83b
1 changed files with 2 additions and 2 deletions

View File

@ -177,8 +177,8 @@ def maybe_update(doc, user) do
with false <- user.local,
avatar <- make_avatar_object(doc),
bio <- string_from_xpath("//author[1]/summary", doc),
name when not is_nil(name) <- string_from_xpath("//author[1]/poco:displayName", doc),
new_data <- %{avatar: avatar, name: name, bio: bio},
name <- string_from_xpath("//author[1]/poco:displayName", doc),
new_data <- %{avatar: avatar || old_data.avatar, name: name || old_data.name, bio: bio || old_data.bio},
false <- new_data == old_data do
change = Ecto.Changeset.change(user, new_data)
Repo.update(change)