From f60d072bbb63edd63e72e81439e31ebaf91b0f3f Mon Sep 17 00:00:00 2001 From: rinpatch Date: Mon, 22 Apr 2019 11:53:37 +0300 Subject: [PATCH] Add `pleroma.in_reply_to_account_acct` to MastoAPI status entity --- docs/api/differences_in_mastoapi_responses.md | 1 + lib/pleroma/web/mastodon_api/views/status_view.ex | 1 + test/web/mastodon_api/status_view_test.exs | 1 + 3 files changed, 3 insertions(+) diff --git a/docs/api/differences_in_mastoapi_responses.md b/docs/api/differences_in_mastoapi_responses.md index 63644fc56..3bb1bd41f 100644 --- a/docs/api/differences_in_mastoapi_responses.md +++ b/docs/api/differences_in_mastoapi_responses.md @@ -20,6 +20,7 @@ Has these additional fields under the `pleroma` object: - `local`: true if the post was made on the local instance. - `conversation_id`: the ID of the conversation the status is associated with (if any) +- `in_reply_to_account_acct`: the `acct` property of User entity for replied user (if any) - `content`: a map consisting of alternate representations of the `content` property with the key being it's mimetype. Currently the only alternate representation supported is `text/plain` - `spoiler_text`: a map consisting of alternate representations of the `spoiler_text` property with the key being it's mimetype. Currently the only alternate representation supported is `text/plain` diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index 17c33080b..decacb0f5 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -238,6 +238,7 @@ def render("status.json", %{activity: %{data: %{"object" => _object}} = activity pleroma: %{ local: activity.local, conversation_id: get_context_id(activity), + in_reply_to_account_acct: reply_to_user && reply_to_user.nickname, content: %{"text/plain" => content_plaintext}, spoiler_text: %{"text/plain" => summary_plaintext} } diff --git a/test/web/mastodon_api/status_view_test.exs b/test/web/mastodon_api/status_view_test.exs index fde931b43..f74726212 100644 --- a/test/web/mastodon_api/status_view_test.exs +++ b/test/web/mastodon_api/status_view_test.exs @@ -128,6 +128,7 @@ test "a note activity" do pleroma: %{ local: true, conversation_id: convo_id, + in_reply_to_account_acct: nil, content: %{"text/plain" => HtmlSanitizeEx.strip_tags(note.data["object"]["content"])}, spoiler_text: %{"text/plain" => HtmlSanitizeEx.strip_tags(note.data["object"]["summary"])} }