Fix remote profile update code.

This commit is contained in:
Roger Braun 2017-09-05 11:40:34 +02:00
parent d1c10ad2fb
commit e9ebfdb83b

View File

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