aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/twitter_api/twitter_api_controller.ex
diff options
context:
space:
mode:
authorRoger Braun <roger@rogerbraun.net>2017-03-22 18:36:08 +0100
committerRoger Braun <roger@rogerbraun.net>2017-03-23 12:09:27 +0100
commit75e51b190d5b4bd4e9cbf6a669bfce7a440e1a5c (patch)
tree4a0d15872d1fcd8ae64dacd9508e0c3a09aea502 /lib/pleroma/web/twitter_api/twitter_api_controller.ex
parente2e0cd75b77778cb7adf911cf279d0ccc008dab1 (diff)
downloadpleroma-75e51b190d5b4bd4e9cbf6a669bfce7a440e1a5c.tar.gz
Add following TwAPI endpoint.
Diffstat (limited to 'lib/pleroma/web/twitter_api/twitter_api_controller.ex')
-rw-r--r--lib/pleroma/web/twitter_api/twitter_api_controller.ex9
1 files changed, 9 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 088439f48..ac319b109 100644
--- a/lib/pleroma/web/twitter_api/twitter_api_controller.ex
+++ b/lib/pleroma/web/twitter_api/twitter_api_controller.ex
@@ -32,6 +32,15 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
|> json_reply(200, json)
end
+ def follow(%{assigns: %{user: user}} = conn, %{ "user_id" => followed_id }) do
+ { :ok, _user, follower } = TwitterAPI.follow(user, followed_id)
+
+ response = follower |> UserRepresenter.to_json
+
+ conn
+ |> json_reply(200, response)
+ end
+
defp json_reply(conn, status, json) do
conn
|> put_resp_content_type("application/json")