aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2020-03-25 17:01:45 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2020-03-25 17:01:45 +0300
commitbe5e2c4dbba63831ea6a0617556e686969b5080f (patch)
tree32af3104df1d88671ea1c2931fca1116bd617e59 /lib/pleroma/web
parent8f1d622b8dfaf6bf00d5f1bf6b988c12766b72ea (diff)
downloadpleroma-be5e2c4dbba63831ea6a0617556e686969b5080f.tar.gz
Applied relationships preloading to GET /api/v1/accounts/relationships. Refactoring (User.binary_id/1).
Diffstat (limited to 'lib/pleroma/web')
-rw-r--r--lib/pleroma/web/mastodon_api/views/account_view.ex6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex
index 702d9e658..6b2eca1f3 100644
--- a/lib/pleroma/web/mastodon_api/views/account_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/account_view.ex
@@ -9,6 +9,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
alias Pleroma.UserRelationship
alias Pleroma.Web.CommonAPI.Utils
alias Pleroma.Web.MastodonAPI.AccountView
+ alias Pleroma.Web.MastodonAPI.StatusView
alias Pleroma.Web.MediaProxy
defp find_following_rel(following_relationships, follower, following) do
@@ -129,7 +130,10 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
end
def render("relationships.json", %{user: user, targets: targets}) do
- render_many(targets, AccountView, "relationship.json", user: user, as: :target)
+ relationships_opts = StatusView.relationships_opts(user, targets)
+ opts = %{as: :target, user: user, relationships: relationships_opts}
+
+ render_many(targets, AccountView, "relationship.json", opts)
end
defp do_render("show.json", %{user: user} = opts) do