aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRoger Braun <rbraun@Bobble.local>2017-09-13 17:18:08 +0200
committerRoger Braun <rbraun@Bobble.local>2017-09-13 17:18:08 +0200
commitad5001828ec77cf9fdf4bfb93ad53568a66bfe8b (patch)
treec9c06f2a9601166b42e6a13d5b49ec6574391117 /lib
parent14b4029b1d8d2f036e39b1aefaf315d35fceaf01 (diff)
downloadpleroma-ad5001828ec77cf9fdf4bfb93ad53568a66bfe8b.tar.gz
Oh no! More datetime fixes!
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/mastodon_api/mastodon_api_controller.ex2
-rw-r--r--lib/pleroma/web/mastodon_api/views/status_view.ex2
2 files changed, 2 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 3f0c7407f..14f7eeeb6 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+$/, ".000Z")
+ |> String.replace(~r/(\.\d+)?$/, ".000Z", global: false)
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 16ed7bd55..a172875df 100644
--- a/lib/pleroma/web/mastodon_api/views/status_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/status_view.ex
@@ -29,7 +29,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
created_at = (object["published"] || "")
|> NaiveDateTime.from_iso8601!
|> NaiveDateTime.to_iso8601
- |> String.replace(~r/\.\d+$/, ".000Z")
+ |> String.replace(~r/(\.\d+)?$/, ".000Z", global: false)
%{
id: activity.id,