forked from AkkomaGang/akkoma
Allign datetime format with mastodon.
This commit is contained in:
parent
d2faee01ee
commit
94be93aad0
3 changed files with 3 additions and 2 deletions
|
@ -158,6 +158,7 @@ def notifications(%{assigns: %{user: user}} = conn, params) 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})}
|
||||
|
|
|
@ -27,7 +27,7 @@ def render("status.json", %{activity: %{data: %{"object" => object}} = activity}
|
|||
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,
|
||||
|
|
|
@ -13,7 +13,7 @@ test "a note activity" 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,
|
||||
|
|
Loading…
Reference in a new issue