forked from AkkomaGang/akkoma
StatusView: implement pleroma.context field
This field replaces the now deprecated conversation_id field, and now exposes the ActivityPub object `context` directly via the MastoAPI instead of relying on StatusNet-era data concepts.
This commit is contained in:
parent
b9bb093600
commit
b3e4d81362
4 changed files with 11 additions and 1 deletions
|
@ -152,9 +152,14 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do
|
||||||
description:
|
description:
|
||||||
"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`"
|
"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`"
|
||||||
},
|
},
|
||||||
|
context: %Schema{
|
||||||
|
type: :string,
|
||||||
|
description: "The thread identifier the status is associated with"
|
||||||
|
},
|
||||||
conversation_id: %Schema{
|
conversation_id: %Schema{
|
||||||
type: :integer,
|
type: :integer,
|
||||||
description: "The ID of the AP context the status is associated with (if any)"
|
deprecated: true,
|
||||||
|
description: "The ID of the AP context the status is associated with (if any); deprecated, please use `context` instead"
|
||||||
},
|
},
|
||||||
direct_conversation_id: %Schema{
|
direct_conversation_id: %Schema{
|
||||||
type: :integer,
|
type: :integer,
|
||||||
|
@ -356,6 +361,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do
|
||||||
"pinned" => false,
|
"pinned" => false,
|
||||||
"pleroma" => %{
|
"pleroma" => %{
|
||||||
"content" => %{"text/plain" => "foobar"},
|
"content" => %{"text/plain" => "foobar"},
|
||||||
|
"context" => "http://localhost:4001/objects/8b4c0c80-6a37-4d2a-b1b9-05a19e3875aa",
|
||||||
"conversation_id" => 345_972,
|
"conversation_id" => 345_972,
|
||||||
"direct_conversation_id" => nil,
|
"direct_conversation_id" => nil,
|
||||||
"emoji_reactions" => [],
|
"emoji_reactions" => [],
|
||||||
|
|
|
@ -378,6 +378,7 @@ def render("show.json", %{activity: %{data: %{"object" => _object}} = activity}
|
||||||
pleroma: %{
|
pleroma: %{
|
||||||
local: activity.local,
|
local: activity.local,
|
||||||
conversation_id: get_context_id(activity),
|
conversation_id: get_context_id(activity),
|
||||||
|
context: object.data["context"],
|
||||||
in_reply_to_account_acct: reply_to_user && reply_to_user.nickname,
|
in_reply_to_account_acct: reply_to_user && reply_to_user.nickname,
|
||||||
content: %{"text/plain" => content_plaintext},
|
content: %{"text/plain" => content_plaintext},
|
||||||
spoiler_text: %{"text/plain" => summary},
|
spoiler_text: %{"text/plain" => summary},
|
||||||
|
|
|
@ -264,6 +264,7 @@ test "posting a fake status", %{conn: conn} do
|
||||||
|> Map.put("url", nil)
|
|> Map.put("url", nil)
|
||||||
|> Map.put("uri", nil)
|
|> Map.put("uri", nil)
|
||||||
|> Map.put("created_at", nil)
|
|> Map.put("created_at", nil)
|
||||||
|
|> Kernel.put_in(["pleroma", "context"], nil)
|
||||||
|> Kernel.put_in(["pleroma", "conversation_id"], nil)
|
|> Kernel.put_in(["pleroma", "conversation_id"], nil)
|
||||||
|
|
||||||
fake_conn =
|
fake_conn =
|
||||||
|
@ -287,6 +288,7 @@ test "posting a fake status", %{conn: conn} do
|
||||||
|> Map.put("url", nil)
|
|> Map.put("url", nil)
|
||||||
|> Map.put("uri", nil)
|
|> Map.put("uri", nil)
|
||||||
|> Map.put("created_at", nil)
|
|> Map.put("created_at", nil)
|
||||||
|
|> Kernel.put_in(["pleroma", "context"], nil)
|
||||||
|> Kernel.put_in(["pleroma", "conversation_id"], nil)
|
|> Kernel.put_in(["pleroma", "conversation_id"], nil)
|
||||||
|
|
||||||
assert real_status == fake_status
|
assert real_status == fake_status
|
||||||
|
|
|
@ -292,6 +292,7 @@ test "a note activity" do
|
||||||
pleroma: %{
|
pleroma: %{
|
||||||
local: true,
|
local: true,
|
||||||
conversation_id: convo_id,
|
conversation_id: convo_id,
|
||||||
|
context: object_data["context"],
|
||||||
in_reply_to_account_acct: nil,
|
in_reply_to_account_acct: nil,
|
||||||
content: %{"text/plain" => HTML.strip_tags(object_data["content"])},
|
content: %{"text/plain" => HTML.strip_tags(object_data["content"])},
|
||||||
spoiler_text: %{"text/plain" => HTML.strip_tags(object_data["summary"])},
|
spoiler_text: %{"text/plain" => HTML.strip_tags(object_data["summary"])},
|
||||||
|
|
Loading…
Reference in a new issue