diff options
author | Roger Braun <roger@rogerbraun.net> | 2017-07-20 20:35:30 +0200 |
---|---|---|
committer | Roger Braun <roger@rogerbraun.net> | 2017-07-20 20:35:30 +0200 |
commit | a027b0027cc06609b112d4341348734c1378d6f2 (patch) | |
tree | 1d1f4ff14d4d866a167f2ac373c9da4449b5eddb /lib/pleroma/web/twitter_api/twitter_api_controller.ex | |
parent | 94a394e3a8949dde95e7e6cc65b46374dd9412a2 (diff) | |
download | pleroma-a027b0027cc06609b112d4341348734c1378d6f2.tar.gz |
Add friends endpoint.
Diffstat (limited to 'lib/pleroma/web/twitter_api/twitter_api_controller.ex')
-rw-r--r-- | lib/pleroma/web/twitter_api/twitter_api_controller.ex | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/pleroma/web/twitter_api/twitter_api_controller.ex b/lib/pleroma/web/twitter_api/twitter_api_controller.ex index ea3030676..9b1c74a3f 100644 --- a/lib/pleroma/web/twitter_api/twitter_api_controller.ex +++ b/lib/pleroma/web/twitter_api/twitter_api_controller.ex @@ -218,6 +218,14 @@ defmodule Pleroma.Web.TwitterAPI.Controller do end end + def friends(%{assigns: %{user: user}} = conn, _params) do + with {:ok, friends} <- User.get_friends(user) do + render(conn, UserView, "index.json", %{users: friends, for: user}) + else + _e -> bad_request_reply(conn, "Can't get friends") + end + end + defp bad_request_reply(conn, error_message) do json = error_json(conn, error_message) json_reply(conn, 400, json) |