Merge branch 'questions-timezone' into 'develop'

Questions: Add timezone to `closed` property

Closes #1552

See merge request pleroma/pleroma!2184
This commit is contained in:
rinpatch 2020-02-07 16:04:40 +00:00
commit 8d01aaa702
2 changed files with 8 additions and 3 deletions

View file

@ -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}

View file

@ -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