Reparse time to ensure correct format.
authorRoger Braun <rbraun@Bobble.local>
Wed, 13 Sep 2017 14:38:29 +0000 (16:38 +0200)
committerRoger Braun <rbraun@Bobble.local>
Wed, 13 Sep 2017 14:38:29 +0000 (16:38 +0200)
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
lib/pleroma/web/mastodon_api/views/status_view.ex

index 8547606dece264ee7f5b110bb5160ddc7a1134c0..3f0c7407f756b1262faf49115bed16863d6d1e9e 100644 (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})}
index 4a3ab7b505a1c730a64e7a8792cd5094fc3d03b6..16ed7bd559e0f8847ecc7efe7f238a3f79d365c2 100644 (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,