[#210] Mastodon: actor storing for media uploads, ownership check to update_media.

Refactoring.
This commit is contained in:
Ivan Tashkinov 2018-12-06 10:26:17 +03:00
commit 3e90f688f1
6 changed files with 38 additions and 27 deletions

View file

@ -93,12 +93,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"]