Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into develop

This commit is contained in:
lain 2018-06-02 15:39:21 +02:00
commit da9cbf2c05
3 changed files with 11 additions and 5 deletions

View file

@ -236,7 +236,11 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
conn conn
|> add_link_headers(:user_statuses, activities, params["id"]) |> add_link_headers(:user_statuses, activities, params["id"])
|> render(StatusView, "index.json", %{activities: activities, for: user, as: :activity}) |> render(StatusView, "index.json", %{
activities: activities,
for: reading_user,
as: :activity
})
end end
end end

View file

@ -309,18 +309,18 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
end end
def followers(conn, params) do def followers(conn, params) do
with {:ok, user} <- TwitterAPI.get_user(conn.assigns.user, params), with {:ok, user} <- TwitterAPI.get_user(conn.assigns[:user], params),
{:ok, followers} <- User.get_followers(user) do {:ok, followers} <- User.get_followers(user) do
render(conn, UserView, "index.json", %{users: followers, for: user}) render(conn, UserView, "index.json", %{users: followers, for: conn.assigns[:user]})
else else
_e -> bad_request_reply(conn, "Can't get followers") _e -> bad_request_reply(conn, "Can't get followers")
end end
end end
def friends(conn, params) do def friends(conn, params) do
with {:ok, user} <- TwitterAPI.get_user(conn.assigns.user, params), with {:ok, user} <- TwitterAPI.get_user(conn.assigns[:user], params),
{:ok, friends} <- User.get_friends(user) do {:ok, friends} <- User.get_friends(user) do
render(conn, UserView, "index.json", %{users: friends, for: user}) render(conn, UserView, "index.json", %{users: friends, for: conn.assigns[:user]})
else else
_e -> bad_request_reply(conn, "Can't get friends") _e -> bad_request_reply(conn, "Can't get friends")
end end

View file

@ -668,6 +668,7 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
conn = conn =
conn conn
|> assign(:user, user)
|> get("/api/statuses/friends", %{"user_id" => user.id}) |> get("/api/statuses/friends", %{"user_id" => user.id})
assert MapSet.equal?( assert MapSet.equal?(
@ -689,6 +690,7 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
conn = conn =
conn conn
|> assign(:user, user)
|> get("/api/statuses/friends", %{"screen_name" => user.nickname}) |> get("/api/statuses/friends", %{"screen_name" => user.nickname})
assert MapSet.equal?( assert MapSet.equal?(