Allign datetime format with mastodon.
This commit is contained in:
parent
d2faee01ee
commit
94be93aad0
3 changed files with 3 additions and 2 deletions
|
@ -158,6 +158,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||
result = Enum.map(notifications, fn (%{id: id, activity: activity, inserted_at: created_at}) ->
|
||||
actor = User.get_cached_by_ap_id(activity.data["actor"])
|
||||
created_at = NaiveDateTime.to_iso8601(created_at)
|
||||
|> String.replace(~r/\.\d+Z/, ".000Z")
|
||||
case activity.data["type"] do
|
||||
"Create" ->
|
||||
%{id: id, type: "mention", created_at: created_at, account: AccountView.render("account.json", %{user: actor}), status: StatusView.render("status.json", %{activity: activity})}
|
||||
|
|
|
@ -27,7 +27,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
|||
attachments = render_many(object["attachment"] || [], StatusView, "attachment.json", as: :attachment)
|
||||
|
||||
created_at = (object["published"] || "")
|
||||
|> String.replace(~r/\.\d+/, "")
|
||||
|> String.replace(~r/\.\d+Z/, ".000Z")
|
||||
|
||||
%{
|
||||
id: activity.id,
|
||||
|
|
|
@ -13,7 +13,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
|
|||
status = StatusView.render("status.json", %{activity: note})
|
||||
|
||||
created_at = (note.data["object"]["published"] || "")
|
||||
|> String.replace(~r/\.\d+/, "")
|
||||
|> String.replace(~r/\.\d+Z/, ".000Z")
|
||||
|
||||
expected = %{
|
||||
id: note.id,
|
||||
|
|
Loading…
Reference in a new issue