Do not require description in update action
This commit is contained in:
parent
0f885b4b86
commit
bb03dfdb03
2 changed files with 2 additions and 15 deletions
|
|
@ -53,10 +53,7 @@ defmodule Pleroma.Web.MastodonAPI.MediaController do
|
|||
def create2(_conn, _data), do: {:error, :bad_request}
|
||||
|
||||
@doc "PUT /api/v1/media/:id"
|
||||
def update(%{assigns: %{user: user}, body_params: %{description: description}} = conn, %{
|
||||
id: id
|
||||
})
|
||||
when is_binary(description) do
|
||||
def update(%{assigns: %{user: user}, body_params: %{description: description}} = conn, %{id: id}) do
|
||||
with %Object{} = object <- Object.get_by_id(id),
|
||||
true <- Object.authorize_mutation(object, user),
|
||||
{:ok, %Object{data: data}} <- Object.update_data(object, %{"name" => description}) do
|
||||
|
|
@ -66,7 +63,7 @@ defmodule Pleroma.Web.MastodonAPI.MediaController do
|
|||
end
|
||||
end
|
||||
|
||||
def update(_conn, _data), do: {:error, :bad_request}
|
||||
def update(conn, data), do: show(conn, data)
|
||||
|
||||
@doc "GET /api/v1/media/:id"
|
||||
def show(conn, %{id: id}) do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue