[#394] User view (Twitter & Mastadon API): wrapped "tags" in "pleroma" map.

This commit is contained in:
Ivan Tashkinov 2018-12-06 22:26:25 +03:00
parent abbf347dc7
commit 7a2162bbcb
4 changed files with 14 additions and 8 deletions

View File

@ -59,9 +59,12 @@ def render("account.json", %{user: user} = opts) do
privacy: user_info.default_scope, privacy: user_info.default_scope,
sensitive: false sensitive: false
}, },
# Pleroma extension # Pleroma extension
pleroma: %{
tags: user.tags tags: user.tags
} }
}
end end
def render("mention.json", %{user: user}) do def render("mention.json", %{user: user}) do

View File

@ -78,9 +78,12 @@ def render("user.json", %{user: user = %User{}} = assigns) do
"default_scope" => user.info.default_scope, "default_scope" => user.info.default_scope,
"no_rich_text" => user.info.no_rich_text, "no_rich_text" => user.info.no_rich_text,
"fields" => fields, "fields" => fields,
# Pleroma extension # Pleroma extension
"pleroma" => %{
"tags" => user.tags "tags" => user.tags
} }
}
if assigns[:token] do if assigns[:token] do
Map.put(data, "token", assigns[:token]) Map.put(data, "token", assigns[:token])

View File

@ -55,7 +55,7 @@ test "Represent a user account" do
privacy: "public", privacy: "public",
sensitive: false sensitive: false
}, },
tags: [] pleroma: %{tags: []}
} }
assert expected == AccountView.render("account.json", %{user: user}) assert expected == AccountView.render("account.json", %{user: user})
@ -93,7 +93,7 @@ test "Represent a Service(bot) account" do
privacy: "public", privacy: "public",
sensitive: false sensitive: false
}, },
tags: [] pleroma: %{tags: []}
} }
assert expected == AccountView.render("account.json", %{user: user}) assert expected == AccountView.render("account.json", %{user: user})

View File

@ -97,7 +97,7 @@ test "A user" do
"default_scope" => "public", "default_scope" => "public",
"no_rich_text" => false, "no_rich_text" => false,
"fields" => [], "fields" => [],
"tags" => [] "pleroma" => %{"tags" => []}
} }
assert represented == UserView.render("show.json", %{user: user}) assert represented == UserView.render("show.json", %{user: user})
@ -139,7 +139,7 @@ test "A user for a given other follower", %{user: user} do
"default_scope" => "public", "default_scope" => "public",
"no_rich_text" => false, "no_rich_text" => false,
"fields" => [], "fields" => [],
"tags" => [] "pleroma" => %{"tags" => []}
} }
assert represented == UserView.render("show.json", %{user: user, for: follower}) assert represented == UserView.render("show.json", %{user: user, for: follower})
@ -182,7 +182,7 @@ test "A user that follows you", %{user: user} do
"default_scope" => "public", "default_scope" => "public",
"no_rich_text" => false, "no_rich_text" => false,
"fields" => [], "fields" => [],
"tags" => [] "pleroma" => %{"tags" => []}
} }
assert represented == UserView.render("show.json", %{user: follower, for: user}) assert represented == UserView.render("show.json", %{user: follower, for: user})
@ -232,7 +232,7 @@ test "A blocked user for the blocker" do
"default_scope" => "public", "default_scope" => "public",
"no_rich_text" => false, "no_rich_text" => false,
"fields" => [], "fields" => [],
"tags" => [] "pleroma" => %{"tags" => []}
} }
blocker = Repo.get(User, blocker.id) blocker = Repo.get(User, blocker.id)