diff options
author | Roger Braun <rbraun@Bobble.local> | 2017-09-13 16:38:29 +0200 |
---|---|---|
committer | Roger Braun <rbraun@Bobble.local> | 2017-09-13 16:38:29 +0200 |
commit | 14b4029b1d8d2f036e39b1aefaf315d35fceaf01 (patch) | |
tree | ccd59744502dca972d0410b19d1ab067e28f9750 /lib | |
parent | 94be93aad08ee9b1d43b1a67d94b694101bf5f1a (diff) | |
download | pleroma-14b4029b1d8d2f036e39b1aefaf315d35fceaf01.tar.gz |
Reparse time to ensure correct format.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 2 | ||||
-rw-r--r-- | lib/pleroma/web/mastodon_api/views/status_view.ex | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index 8547606de..3f0c7407f 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -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})} diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index 4a3ab7b50..16ed7bd55 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -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, |