diff options
author | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2023-11-16 15:48:37 +0100 |
---|---|---|
committer | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2023-11-16 15:52:01 +0100 |
commit | 8ac7cc98c1ba241ce104cc2ee15723f087c367d2 (patch) | |
tree | 2013ea39c028b968974ab27d6ead10b3206d78ed | |
parent | bf2d6abaf2f7ccc908c512a8d5be4e091779e9e5 (diff) | |
download | pleroma-8ac7cc98c1ba241ce104cc2ee15723f087c367d2.tar.gz pleroma-8ac7cc98c1ba241ce104cc2ee15723f087c367d2.zip |
MastoAPI AccountView: Change last_status_at to be a date
Changed in Mastodon 3.1.0 with: https://github.com/tootsuite/mastodon/pull/12966
-rw-r--r-- | changelog.d/last_status_at.change | 1 | ||||
-rw-r--r-- | lib/pleroma/web/mastodon_api/views/account_view.ex | 11 |
2 files changed, 10 insertions, 2 deletions
diff --git a/changelog.d/last_status_at.change b/changelog.d/last_status_at.change new file mode 100644 index 000000000..5417aff30 --- /dev/null +++ b/changelog.d/last_status_at.change @@ -0,0 +1 @@ +- Change AccountView `last_status_at` from a datetime to a date (as done in Mastodon 3.1.0)
\ No newline at end of file diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex index cc3e3582f..34478cec8 100644 --- a/lib/pleroma/web/mastodon_api/views/account_view.ex +++ b/lib/pleroma/web/mastodon_api/views/account_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2023 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.AccountView do @@ -249,6 +249,13 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do nil end + last_status_at = + if not is_nil(user.last_status_at) do + user.last_status_at |> NaiveDateTime.to_date() |> Date.to_iso8601() + else + nil + end + %{ id: to_string(user.id), username: username_from_nickname(user.nickname), @@ -277,7 +284,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do actor_type: user.actor_type } }, - last_status_at: user.last_status_at, + last_status_at: last_status_at, # Pleroma extensions # Note: it's insecure to output :email but fully-qualified nickname may serve as safe stub |