diff options
author | Roger Braun <roger@rogerbraun.net> | 2017-03-23 13:13:09 +0100 |
---|---|---|
committer | Roger Braun <roger@rogerbraun.net> | 2017-03-23 13:13:09 +0100 |
commit | 30650e5bc610810d129bf02891a73ac11340710b (patch) | |
tree | 961bc760faea353f875f32325acd0cc296ce16ad /lib/pleroma/web/twitter_api/twitter_api_controller.ex | |
parent | 75e51b190d5b4bd4e9cbf6a669bfce7a440e1a5c (diff) | |
download | pleroma-30650e5bc610810d129bf02891a73ac11340710b.tar.gz |
Add unfollowing to TwAPI.
Diffstat (limited to 'lib/pleroma/web/twitter_api/twitter_api_controller.ex')
-rw-r--r-- | lib/pleroma/web/twitter_api/twitter_api_controller.ex | 10 |
1 files changed, 10 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 ac319b109..d574f1003 100644 --- a/lib/pleroma/web/twitter_api/twitter_api_controller.ex +++ b/lib/pleroma/web/twitter_api/twitter_api_controller.ex @@ -41,6 +41,16 @@ defmodule Pleroma.Web.TwitterAPI.Controller do |> json_reply(200, response) end + def unfollow(%{assigns: %{user: user}} = conn, %{ "user_id" => followed_id }) do + { :ok, _user, follower } = TwitterAPI.unfollow(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") |