logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: ef8a2134bc9e2e9f3aa08172b982c347332e14c1
parent 6a191a91abc4d86ab564d06c9fcdbb43116fd333
Author: Lain Soykaf <lain@lain.com>
Date:   Thu,  7 Dec 2023 11:25:18 +0400

AccountView: Add test, refactor

Diffstat:

Mlib/pleroma/web/mastodon_api/views/account_view.ex5+----
Mtest/pleroma/web/mastodon_api/views/account_view_test.exs5+++--
2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex @@ -250,11 +250,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do end last_status_at = - if not is_nil(user.last_status_at) do + user.last_status_at && user.last_status_at |> NaiveDateTime.to_date() |> Date.to_iso8601() - else - nil - end %{ id: to_string(user.id), diff --git a/test/pleroma/web/mastodon_api/views/account_view_test.exs b/test/pleroma/web/mastodon_api/views/account_view_test.exs @@ -35,7 +35,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do inserted_at: ~N[2017-08-15 15:47:06.597036], emoji: %{"karjalanpiirakka" => "/file.png"}, 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"], + last_status_at: NaiveDateTime.utc_now() }) expected = %{ @@ -74,7 +75,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do fields: [] }, fqn: "shp@shitposter.club", - last_status_at: nil, + last_status_at: user.last_status_at |> NaiveDateTime.to_date() |> Date.to_iso8601(), pleroma: %{ ap_id: user.ap_id, also_known_as: ["https://shitposter.zone/users/shp"],