Browse Source

Reparse time to ensure correct format.

tags/v0.9.9
Roger Braun 6 years ago
parent
commit
14b4029b1d
2 changed files with 4 additions and 2 deletions
  1. +1
    -1
      lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
  2. +3
    -1
      lib/pleroma/web/mastodon_api/views/status_view.ex

+ 1
- 1
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex View File

@@ -158,7 +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")
|> String.replace(~r/\.\d+$/, ".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})}


+ 3
- 1
lib/pleroma/web/mastodon_api/views/status_view.ex View File

@@ -27,7 +27,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
attachments = render_many(object["attachment"] || [], StatusView, "attachment.json", as: :attachment)

created_at = (object["published"] || "")
|> String.replace(~r/\.\d+Z/, ".000Z")
|> NaiveDateTime.from_iso8601!
|> NaiveDateTime.to_iso8601
|> String.replace(~r/\.\d+$/, ".000Z")

%{
id: activity.id,


Loading…
Cancel
Save