Merge pull request 'Return last_status_at as date, not datetime' (#681) from katafrakt/akkoma:fix-last-status-at into develop
Some checks are pending
ci/woodpecker/push/build-amd64 Pipeline is pending
ci/woodpecker/push/build-arm64 Pipeline is pending
ci/woodpecker/push/docs Pipeline is pending
ci/woodpecker/push/lint Pipeline is pending
ci/woodpecker/push/test Pipeline is pending

Reviewed-on: #681
This commit is contained in:
floatingghost 2024-02-17 11:37:19 +00:00
commit 289f93f5a2
2 changed files with 7 additions and 3 deletions

View file

@ -261,6 +261,9 @@ defp do_render("show.json", %{user: user} = opts) do
|> MediaProxy.url()
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),
username: username_from_nickname(user.nickname),
@ -289,7 +292,7 @@ defp do_render("show.json", %{user: user} = opts) do
actor_type: user.actor_type
}
},
last_status_at: user.last_status_at,
last_status_at: last_status_at,
akkoma: %{
instance: render("instance.json", %{instance: instance}),
status_ttl_days: user.status_ttl_days,

View file

@ -40,7 +40,8 @@ test "Represent a user account" do
emoji: %{"karjalanpiirakka" => "/file.png"},
raw_bio: "valid html. a\nb\nc\nd\nf '&<>\"",
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"}})
@ -92,7 +93,7 @@ test "Represent a user account" do
fields: []
},
fqn: "shp@shitposter.club",
last_status_at: nil,
last_status_at: ~D[2023-12-31],
pleroma: %{
ap_id: user.ap_id,
also_known_as: ["https://shitposter.zone/users/shp"],