Use info.fields instead of source_data for remote users
This commit is contained in:
parent
2c35d4b0b0
commit
f7bbf99caa
10 changed files with 91 additions and 39 deletions
|
|
@ -518,9 +518,9 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
|
||||
user = User.get_cached_by_ap_id(activity.actor)
|
||||
|
||||
assert user.info.source_data["attachment"] == [
|
||||
%{"name" => "foo", "type" => "PropertyValue", "value" => "bar"},
|
||||
%{"name" => "foo1", "type" => "PropertyValue", "value" => "bar1"}
|
||||
assert User.Info.fields(user.info) == [
|
||||
%{"name" => "foo", "value" => "bar"},
|
||||
%{"name" => "foo1", "value" => "bar1"}
|
||||
]
|
||||
|
||||
update_data = File.read!("test/fixtures/mastodon-update.json") |> Poison.decode!()
|
||||
|
|
@ -539,9 +539,9 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
|
||||
user = User.get_cached_by_ap_id(user.ap_id)
|
||||
|
||||
assert user.info.source_data["attachment"] == [
|
||||
%{"name" => "foo", "type" => "PropertyValue", "value" => "updated"},
|
||||
%{"name" => "foo1", "type" => "PropertyValue", "value" => "updated"}
|
||||
assert User.Info.fields(user.info) == [
|
||||
%{"name" => "foo", "value" => "updated"},
|
||||
%{"name" => "foo1", "value" => "updated"}
|
||||
]
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -24,21 +24,16 @@ defmodule Pleroma.Web.ActivityPub.UserViewTest do
|
|||
|
||||
test "Renders profile fields" do
|
||||
fields = [
|
||||
%{"name" => "foo", "value" => "bar"},
|
||||
%{"name" => "website", "value" => "cofe.my"}
|
||||
%{"name" => "foo", "value" => "bar"}
|
||||
]
|
||||
|
||||
user = insert(:user, info: %{fields: fields})
|
||||
{:ok, user} =
|
||||
insert(:user)
|
||||
|> User.upgrade_changeset(%{info: %{fields: fields}})
|
||||
|> User.update_and_set_cache()
|
||||
|
||||
assert %{
|
||||
"attachment" => [
|
||||
%{"name" => "foo", "type" => "PropertyValue", "value" => "bar"},
|
||||
%{
|
||||
"name" => "website",
|
||||
"type" => "PropertyValue",
|
||||
"value" => "<a href=\"http://cofe.my\">cofe.my</a>"
|
||||
}
|
||||
]
|
||||
"attachment" => [%{"name" => "foo", "type" => "PropertyValue", "value" => "bar"}]
|
||||
} = UserView.render("user.json", %{user: user})
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue