diff options
| -rw-r--r-- | lib/pleroma/web/common_api/utils.ex | 6 | ||||
| -rw-r--r-- | test/web/mastodon_api/controllers/status_controller_test.exs | 5 | 
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex index a9b164d9a..ca6c93862 100644 --- a/lib/pleroma/web/common_api/utils.ex +++ b/lib/pleroma/web/common_api/utils.ex @@ -179,9 +179,9 @@ defmodule Pleroma.Web.CommonAPI.Utils do          end)        end_time = -        NaiveDateTime.utc_now() -        |> NaiveDateTime.add(expires_in) -        |> NaiveDateTime.to_iso8601() +        DateTime.utc_now() +        |> DateTime.add(expires_in) +        |> DateTime.to_iso8601()        key = if truthy_param?(data["poll"]["multiple"]), do: "anyOf", else: "oneOf"        poll = %{"type" => "Question", key => option_notes, "closed" => end_time} diff --git a/test/web/mastodon_api/controllers/status_controller_test.exs b/test/web/mastodon_api/controllers/status_controller_test.exs index b03b4b344..83138d7ef 100644 --- a/test/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/web/mastodon_api/controllers/status_controller_test.exs @@ -370,6 +370,11 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do        assert NaiveDateTime.diff(NaiveDateTime.from_iso8601!(response["poll"]["expires_at"]), time) in 420..430        refute response["poll"]["expred"] + +      question = Object.get_by_id(response["poll"]["id"]) + +      # closed contains utc timezone +      assert question.data["closed"] =~ "Z"      end      test "option limit is enforced", %{conn: conn} do  | 
