diff options
| -rw-r--r-- | lib/pleroma/web/mastodon_api/controllers/status_controller.ex | 3 | ||||
| -rw-r--r-- | test/web/mastodon_api/controllers/status_controller_test.exs | 11 | 
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index 397dd10e3..f6e4f7d66 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -127,7 +127,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusController do    def create(          %{assigns: %{user: user}} = conn,          %{"status" => _, "scheduled_at" => scheduled_at} = params -      ) do +      ) +      when not is_nil(scheduled_at) do      params = Map.put(params, "in_reply_to_status_id", params["in_reply_to_id"])      with {:far_enough, true} <- {:far_enough, ScheduledActivity.far_enough?(scheduled_at)}, diff --git a/test/web/mastodon_api/controllers/status_controller_test.exs b/test/web/mastodon_api/controllers/status_controller_test.exs index 162f7b1b2..85068edd0 100644 --- a/test/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/web/mastodon_api/controllers/status_controller_test.exs @@ -302,6 +302,17 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do        assert [] == Repo.all(Activity)      end +    test "ignores nil values", %{conn: conn} do +      conn = +        post(conn, "/api/v1/statuses", %{ +          "status" => "not scheduled", +          "scheduled_at" => nil +        }) + +      assert result = json_response(conn, 200) +      assert Activity.get_by_id(result["id"]) +    end +      test "creates a scheduled activity with a media attachment", %{user: user, conn: conn} do        scheduled_at = NaiveDateTime.add(NaiveDateTime.utc_now(), :timer.minutes(120), :millisecond)  | 
