diff options
author | Egor Kislitsyn <egor@kislitsyn.com> | 2020-05-14 16:29:32 +0400 |
---|---|---|
committer | Egor Kislitsyn <egor@kislitsyn.com> | 2020-05-14 16:29:32 +0400 |
commit | bb03dfdb03714027640087ad1bd6475a8bb1c2c3 (patch) | |
tree | 79f01724b58ba1cef2645cc9e0add07e9692d978 /lib | |
parent | 0f885b4b86ad7ba738ef0dd0de7f7d0496b7e43d (diff) | |
download | pleroma-bb03dfdb03714027640087ad1bd6475a8bb1c2c3.tar.gz |
Do not require `description` in `update` action
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/mastodon_api/controllers/media_controller.ex | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/pleroma/web/mastodon_api/controllers/media_controller.ex b/lib/pleroma/web/mastodon_api/controllers/media_controller.ex index 3b2ea751c..a21233393 100644 --- a/lib/pleroma/web/mastodon_api/controllers/media_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/media_controller.ex @@ -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 |