[#210] [TwitterAPI] Made actor be stored for uploads. Added ownership check
to `update_media` action. Added controller tests for `upload` and `update_media` actions. Refactoring.
This commit is contained in:
parent
53797d19c5
commit
848151f7cb
8 changed files with 120 additions and 40 deletions
|
|
@ -93,8 +93,12 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
|
|||
end
|
||||
end
|
||||
|
||||
def upload(%Plug.Upload{} = file, format \\ "xml") do
|
||||
{:ok, object} = ActivityPub.upload(file)
|
||||
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)
|
||||
|
||||
url = List.first(object.data["url"])
|
||||
href = url["href"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue