Add unliking to TwAPI controller.
This commit is contained in:
parent
f4eea0847b
commit
c83f279a7d
4 changed files with 34 additions and 3 deletions
|
|
@ -42,5 +42,6 @@ defmodule Pleroma.Web.Router do
|
|||
post "/media/upload", TwitterAPI.Controller, :upload_json
|
||||
post "/favorites/create/:id", TwitterAPI.Controller, :favorite
|
||||
post "/favorites/create", TwitterAPI.Controller, :favorite
|
||||
post "/favorites/destroy/:id", TwitterAPI.Controller, :unfavorite
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -113,6 +113,15 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
|
|||
|> json_reply(200, response)
|
||||
end
|
||||
|
||||
def unfavorite(%{assigns: %{user: user}} = conn, %{"id" => id}) do
|
||||
activity = Repo.get(Activity, id)
|
||||
{:ok, status} = TwitterAPI.unfavorite(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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue