Add new frontend options to server-side config.
[akkoma] / lib / pleroma / web / twitter_api / twitter_api.ex
index b9468ab0369aae55a3e4503c65615244dceefccf..79ea48d86cdd2a448e707cd9d1ae944cba02efca 100644 (file)
@@ -2,18 +2,15 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
   alias Pleroma.{UserInviteToken, User, Activity, Repo, Object}
   alias Pleroma.Web.ActivityPub.ActivityPub
   alias Pleroma.Web.TwitterAPI.UserView
-  alias Pleroma.Web.{OStatus, CommonAPI}
-  alias Pleroma.Web.MediaProxy
+  alias Pleroma.Web.CommonAPI
   import Ecto.Query
 
-  @httpoison Application.get_env(:pleroma, :httpoison)
-
   def create_status(%User{} = user, %{"status" => _} = data) do
     CommonAPI.post(user, data)
   end
 
   def delete(%User{} = user, id) do
-    with %Activity{data: %{"type" => type}} <- Repo.get(Activity, id),
+    with %Activity{data: %{"type" => _type}} <- Repo.get(Activity, id),
          {:ok, activity} <- CommonAPI.delete(id, user) do
       {:ok, activity}
     end
@@ -37,7 +34,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
 
   def unfollow(%User{} = follower, params) do
     with {:ok, %User{} = unfollowed} <- get_user(params),
-         {:ok, follower, follow_activity} <- User.unfollow(follower, unfollowed),
+         {:ok, follower, _follow_activity} <- User.unfollow(follower, unfollowed),
          {:ok, _activity} <- ActivityPub.unfollow(follower, unfollowed) do
       {:ok, follower, unfollowed}
     else
@@ -93,12 +90,8 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
     end
   end
 
-  def ap_upload(%Plug.Upload{} = file, %User{} = user) do
-    ActivityPub.upload(file, actor: User.ap_id(user))
-  end
-
   def upload(%Plug.Upload{} = file, %User{} = user, format \\ "xml") do
-    {:ok, object} = ap_upload(file, user)
+    {:ok, object} = ActivityPub.upload(file, actor: User.ap_id(user))
 
     url = List.first(object.data["url"])
     href = url["href"]
@@ -248,10 +241,6 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
     _activities = Repo.all(q)
   end
 
-  defp make_date do
-    DateTime.utc_now() |> DateTime.to_iso8601()
-  end
-
   # DEPRECATED mostly, context objects are now created at insertion time.
   def context_to_conversation_id(context) do
     with %Object{id: id} <- Object.get_cached_by_ap_id(context) do