From 7a2162bbcb2e3a64ed6b56229311aa9fd487351a Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Thu, 6 Dec 2018 22:26:25 +0300 Subject: [PATCH] [#394] User view (Twitter & Mastadon API): wrapped "tags" in "pleroma" map. --- lib/pleroma/web/mastodon_api/views/account_view.ex | 5 ++++- lib/pleroma/web/twitter_api/views/user_view.ex | 5 ++++- test/web/mastodon_api/account_view_test.exs | 4 ++-- test/web/twitter_api/views/user_view_test.exs | 8 ++++---- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex index 2762813ae..ebcf9230b 100644 --- a/lib/pleroma/web/mastodon_api/views/account_view.ex +++ b/lib/pleroma/web/mastodon_api/views/account_view.ex @@ -59,8 +59,11 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do privacy: user_info.default_scope, sensitive: false }, + # Pleroma extension - tags: user.tags + pleroma: %{ + tags: user.tags + } } end diff --git a/lib/pleroma/web/twitter_api/views/user_view.ex b/lib/pleroma/web/twitter_api/views/user_view.ex index f460ddd80..b3459af9a 100644 --- a/lib/pleroma/web/twitter_api/views/user_view.ex +++ b/lib/pleroma/web/twitter_api/views/user_view.ex @@ -78,8 +78,11 @@ defmodule Pleroma.Web.TwitterAPI.UserView do "default_scope" => user.info.default_scope, "no_rich_text" => user.info.no_rich_text, "fields" => fields, + # Pleroma extension - "tags" => user.tags + "pleroma" => %{ + "tags" => user.tags + } } if assigns[:token] do diff --git a/test/web/mastodon_api/account_view_test.exs b/test/web/mastodon_api/account_view_test.exs index d6c9f58c8..3cb9b9c5b 100644 --- a/test/web/mastodon_api/account_view_test.exs +++ b/test/web/mastodon_api/account_view_test.exs @@ -55,7 +55,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do privacy: "public", sensitive: false }, - tags: [] + pleroma: %{tags: []} } assert expected == AccountView.render("account.json", %{user: user}) @@ -93,7 +93,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do privacy: "public", sensitive: false }, - tags: [] + pleroma: %{tags: []} } assert expected == AccountView.render("account.json", %{user: user}) diff --git a/test/web/twitter_api/views/user_view_test.exs b/test/web/twitter_api/views/user_view_test.exs index 0bd06f256..9898c217d 100644 --- a/test/web/twitter_api/views/user_view_test.exs +++ b/test/web/twitter_api/views/user_view_test.exs @@ -97,7 +97,7 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do "default_scope" => "public", "no_rich_text" => false, "fields" => [], - "tags" => [] + "pleroma" => %{"tags" => []} } assert represented == UserView.render("show.json", %{user: user}) @@ -139,7 +139,7 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do "default_scope" => "public", "no_rich_text" => false, "fields" => [], - "tags" => [] + "pleroma" => %{"tags" => []} } assert represented == UserView.render("show.json", %{user: user, for: follower}) @@ -182,7 +182,7 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do "default_scope" => "public", "no_rich_text" => false, "fields" => [], - "tags" => [] + "pleroma" => %{"tags" => []} } assert represented == UserView.render("show.json", %{user: follower, for: user}) @@ -232,7 +232,7 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do "default_scope" => "public", "no_rich_text" => false, "fields" => [], - "tags" => [] + "pleroma" => %{"tags" => []} } blocker = Repo.get(User, blocker.id)