diff options
author | Roger Braun <rbraun@Bobble.local> | 2017-09-13 16:26:02 +0200 |
---|---|---|
committer | Roger Braun <rbraun@Bobble.local> | 2017-09-13 16:26:02 +0200 |
commit | 94be93aad08ee9b1d43b1a67d94b694101bf5f1a (patch) | |
tree | aa769318a1f54792d0f33856ccc42f68bae36532 | |
parent | d2faee01eea3a0cc8eed95d749d41c4a26556a13 (diff) | |
download | pleroma-94be93aad08ee9b1d43b1a67d94b694101bf5f1a.tar.gz |
Allign datetime format with mastodon.
-rw-r--r-- | lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 1 | ||||
-rw-r--r-- | lib/pleroma/web/mastodon_api/views/status_view.ex | 2 | ||||
-rw-r--r-- | test/web/mastodon_api/status_view_test.exs | 2 |
3 files changed, 3 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 dede0434d..8547606de 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -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})} diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index cc5c0e9b6..4a3ab7b50 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -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, diff --git a/test/web/mastodon_api/status_view_test.exs b/test/web/mastodon_api/status_view_test.exs index 3c2de4cbe..198ee72a8 100644 --- a/test/web/mastodon_api/status_view_test.exs +++ b/test/web/mastodon_api/status_view_test.exs @@ -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, |