ChatView: Add actor_account_id
This commit is contained in:
parent
00e956528b
commit
49e673dfea
@ -14,6 +14,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.ChatMessageResponse do
|
|||||||
properties: %{
|
properties: %{
|
||||||
id: %Schema{type: :string},
|
id: %Schema{type: :string},
|
||||||
actor: %Schema{type: :string, description: "The ActivityPub id of the actor"},
|
actor: %Schema{type: :string, description: "The ActivityPub id of the actor"},
|
||||||
|
actor_account_id: %Schema{type: :string, description: "The Mastodon API id of the actor"},
|
||||||
chat_id: %Schema{type: :string},
|
chat_id: %Schema{type: :string},
|
||||||
content: %Schema{type: :string},
|
content: %Schema{type: :string},
|
||||||
created_at: %Schema{type: :string, format: :datetime},
|
created_at: %Schema{type: :string, format: :datetime},
|
||||||
@ -21,6 +22,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.ChatMessageResponse do
|
|||||||
},
|
},
|
||||||
example: %{
|
example: %{
|
||||||
"actor" => "https://dontbulling.me/users/lain",
|
"actor" => "https://dontbulling.me/users/lain",
|
||||||
|
"actor_account_id" => "someflakeid",
|
||||||
"chat_id" => "1",
|
"chat_id" => "1",
|
||||||
"content" => "hey you again",
|
"content" => "hey you again",
|
||||||
"created_at" => "2020-04-21T15:06:45.000Z",
|
"created_at" => "2020-04-21T15:06:45.000Z",
|
||||||
|
@ -8,6 +8,7 @@ defmodule Pleroma.Web.PleromaAPI.ChatMessageView do
|
|||||||
alias Pleroma.Chat
|
alias Pleroma.Chat
|
||||||
alias Pleroma.Web.CommonAPI.Utils
|
alias Pleroma.Web.CommonAPI.Utils
|
||||||
alias Pleroma.Web.MastodonAPI.StatusView
|
alias Pleroma.Web.MastodonAPI.StatusView
|
||||||
|
alias Pleroma.User
|
||||||
|
|
||||||
def render(
|
def render(
|
||||||
"show.json",
|
"show.json",
|
||||||
@ -21,6 +22,7 @@ def render(
|
|||||||
content: chat_message["content"],
|
content: chat_message["content"],
|
||||||
chat_id: chat_id |> to_string(),
|
chat_id: chat_id |> to_string(),
|
||||||
actor: chat_message["actor"],
|
actor: chat_message["actor"],
|
||||||
|
actor_account_id: User.get_cached_by_ap_id(chat_message["actor"]).id,
|
||||||
created_at: Utils.to_masto_date(chat_message["published"]),
|
created_at: Utils.to_masto_date(chat_message["published"]),
|
||||||
emojis: StatusView.build_emojis(chat_message["emoji"])
|
emojis: StatusView.build_emojis(chat_message["emoji"])
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ test "it displays a chat message" do
|
|||||||
assert chat_message[:id] == object.id |> to_string()
|
assert chat_message[:id] == object.id |> to_string()
|
||||||
assert chat_message[:content] == "kippis :firefox:"
|
assert chat_message[:content] == "kippis :firefox:"
|
||||||
assert chat_message[:actor] == user.ap_id
|
assert chat_message[:actor] == user.ap_id
|
||||||
|
assert chat_message[:actor_account_id] == user.id
|
||||||
assert chat_message[:chat_id]
|
assert chat_message[:chat_id]
|
||||||
assert chat_message[:created_at]
|
assert chat_message[:created_at]
|
||||||
assert match?([%{shortcode: "firefox"}], chat_message[:emojis])
|
assert match?([%{shortcode: "firefox"}], chat_message[:emojis])
|
||||||
@ -39,6 +40,7 @@ test "it displays a chat message" do
|
|||||||
assert chat_message_two[:id] == object.id |> to_string()
|
assert chat_message_two[:id] == object.id |> to_string()
|
||||||
assert chat_message_two[:content] == "gkgkgk"
|
assert chat_message_two[:content] == "gkgkgk"
|
||||||
assert chat_message_two[:actor] == recipient.ap_id
|
assert chat_message_two[:actor] == recipient.ap_id
|
||||||
|
assert chat_message_two[:actor_account_id] == recipient.id
|
||||||
assert chat_message_two[:chat_id] == chat_message[:chat_id]
|
assert chat_message_two[:chat_id] == chat_message[:chat_id]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user