1
0
Fork 0
forked from mirrors/akkoma

Allign datetime format with mastodon.

This commit is contained in:
Roger Braun 2017-09-13 16:26:02 +02:00
parent d2faee01ee
commit 94be93aad0
3 changed files with 3 additions and 2 deletions

View file

@ -158,6 +158,7 @@ def notifications(%{assigns: %{user: user}} = conn, params) 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})}

View file

@ -27,7 +27,7 @@ def render("status.json", %{activity: %{data: %{"object" => object}} = activity}
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,

View file

@ -13,7 +13,7 @@ test "a note activity" 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,