Return last_status_at as date, not datetime

This commit is contained in:
Paweł Świątkowski 2024-02-05 21:42:15 +01:00
parent e97d08ee98
commit df21b61829
No known key found for this signature in database
GPG key ID: E8F0A30143BCE32C
2 changed files with 7 additions and 3 deletions

View file

@ -261,6 +261,9 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
|> MediaProxy.url() |> MediaProxy.url()
end end
last_status_at =
if is_nil(user.last_status_at), do: nil, else: NaiveDateTime.to_date(user.last_status_at)
%{ %{
id: to_string(user.id), id: to_string(user.id),
username: username_from_nickname(user.nickname), username: username_from_nickname(user.nickname),
@ -289,7 +292,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
actor_type: user.actor_type actor_type: user.actor_type
} }
}, },
last_status_at: user.last_status_at, last_status_at: last_status_at,
akkoma: %{ akkoma: %{
instance: render("instance.json", %{instance: instance}), instance: render("instance.json", %{instance: instance}),
status_ttl_days: user.status_ttl_days status_ttl_days: user.status_ttl_days

View file

@ -40,7 +40,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
emoji: %{"karjalanpiirakka" => "/file.png"}, emoji: %{"karjalanpiirakka" => "/file.png"},
raw_bio: "valid html. a\nb\nc\nd\nf '&<>\"", raw_bio: "valid html. a\nb\nc\nd\nf '&<>\"",
also_known_as: ["https://shitposter.zone/users/shp"], also_known_as: ["https://shitposter.zone/users/shp"],
status_ttl_days: 5 status_ttl_days: 5,
last_status_at: ~N[2023-12-31T15:06:17]
}) })
insert(:instance, %{host: "example.com", nodeinfo: %{version: "2.1"}}) insert(:instance, %{host: "example.com", nodeinfo: %{version: "2.1"}})
@ -91,7 +92,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
fields: [] fields: []
}, },
fqn: "shp@shitposter.club", fqn: "shp@shitposter.club",
last_status_at: nil, last_status_at: ~D[2023-12-31],
pleroma: %{ pleroma: %{
ap_id: user.ap_id, ap_id: user.ap_id,
also_known_as: ["https://shitposter.zone/users/shp"], also_known_as: ["https://shitposter.zone/users/shp"],