diff options
author | Tusooa Zhu <tusooa@kazv.moe> | 2022-06-03 21:47:40 -0400 |
---|---|---|
committer | Tusooa Zhu <tusooa@kazv.moe> | 2022-06-03 21:47:40 -0400 |
commit | 3249ac1f12b69718cacc193c020e8bdccf167a9e (patch) | |
tree | 2492fe93b62ffcebfa353c70e0556b3f1c713c4d /lib | |
parent | fdaa8640838c741500839f66fc7902c88d449afd (diff) | |
download | pleroma-3249ac1f12b69718cacc193c020e8bdccf167a9e.tar.gz pleroma-3249ac1f12b69718cacc193c020e8bdccf167a9e.zip |
Show edited_at in MastodonAPI/show
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/api_spec/schemas/status.ex | 6 | ||||
-rw-r--r-- | lib/pleroma/web/mastodon_api/views/status_view.ex | 11 |
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/pleroma/web/api_spec/schemas/status.ex b/lib/pleroma/web/api_spec/schemas/status.ex index 6e6e30315..f803caec2 100644 --- a/lib/pleroma/web/api_spec/schemas/status.ex +++ b/lib/pleroma/web/api_spec/schemas/status.ex @@ -73,6 +73,12 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do format: "date-time", description: "The date when this status was created" }, + edited_at: %Schema{ + type: :string, + format: "date-time", + nullable: true, + description: "The date when this status was last edited" + }, emojis: %Schema{ type: :array, items: Emoji, diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index 8d4685ffa..4afba4b33 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -258,6 +258,16 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do created_at = Utils.to_masto_date(object.data["published"]) + edited_at = + with %{"updated" => updated} <- object.data, + date <- Utils.to_masto_date(updated), + true <- date != "" do + date + else + _ -> + nil + end + reply_to = get_reply_to(activity, opts) reply_to_user = reply_to && CommonAPI.get_user(reply_to.data["actor"]) @@ -346,6 +356,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do content: content_html, text: opts[:with_source] && object.data["source"], created_at: created_at, + edited_at: edited_at, reblogs_count: announcement_count, replies_count: object.data["repliesCount"] || 0, favourites_count: like_count, |