From 9202904da9b48eb2a3884b8e89ea879e01d44b9a Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sat, 28 Sep 2019 01:21:28 +0200 Subject: [PATCH] status_controller.ex: Posting media status without content defined --- .../web/mastodon_api/controllers/status_controller.ex | 4 ++++ test/web/mastodon_api/controllers/status_controller_test.exs | 5 ++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index f7da10289..ae3d51575 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -103,6 +103,10 @@ defmodule Pleroma.Web.MastodonAPI.StatusController do end end + def create(%{assigns: %{user: _user}} = conn, %{"media_ids" => _} = params) do + create(conn, Map.put(params, "status", "")) + end + @doc "GET /api/v1/statuses/:id" def show(%{assigns: %{user: user}} = conn, %{"id" => id}) do with %Activity{} = activity <- Activity.get_by_id_with_object(id), diff --git a/test/web/mastodon_api/controllers/status_controller_test.exs b/test/web/mastodon_api/controllers/status_controller_test.exs index c0121ac63..b194feae6 100644 --- a/test/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/web/mastodon_api/controllers/status_controller_test.exs @@ -99,7 +99,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do NaiveDateTime.to_iso8601(expiration.scheduled_at) end - test "posting an empty status with an attachment", %{conn: conn} do + test "posting an undefined status with an attachment", %{conn: conn} do user = insert(:user) file = %Plug.Upload{ @@ -114,8 +114,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do conn |> assign(:user, user) |> post("/api/v1/statuses", %{ - "media_ids" => [to_string(upload.id)], - "status" => "" + "media_ids" => [to_string(upload.id)] }) assert json_response(conn, 200) -- 2.45.2