Add retweeting to TwAPI controller.
[akkoma] / lib / pleroma / web / twitter_api / twitter_api_controller.ex
index c71c123b21c276cc5f4c62f704e302d7d44fd4e6..a4d8a1d14ee44e2067c8a252313b7a513069bbcc 100644 (file)
@@ -122,6 +122,15 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
     |> json_reply(200, response)
   end
 
+  def retweet(%{assigns: %{user: user}} = conn, %{"id" => id}) do
+    activity = Repo.get(Activity, id)
+    {:ok, status} = TwitterAPI.retweet(user, activity)
+    response = Poison.encode!(status)
+
+    conn
+    |> json_reply(200, response)
+  end
+
   defp json_reply(conn, status, json) do
     conn
     |> put_resp_content_type("application/json")