properties: %{
id: %Schema{type: :string},
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},
content: %Schema{type: :string},
created_at: %Schema{type: :string, format: :datetime},
},
example: %{
"actor" => "https://dontbulling.me/users/lain",
+ "actor_account_id" => "someflakeid",
"chat_id" => "1",
"content" => "hey you again",
"created_at" => "2020-04-21T15:06:45.000Z",
alias Pleroma.Chat
alias Pleroma.Web.CommonAPI.Utils
alias Pleroma.Web.MastodonAPI.StatusView
+ alias Pleroma.User
def render(
"show.json",
content: chat_message["content"],
chat_id: chat_id |> to_string(),
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"]),
emojis: StatusView.build_emojis(chat_message["emoji"])
}
assert chat_message[:id] == object.id |> to_string()
assert chat_message[:content] == "kippis :firefox:"
assert chat_message[:actor] == user.ap_id
+ assert chat_message[:actor_account_id] == user.id
assert chat_message[:chat_id]
assert chat_message[:created_at]
assert match?([%{shortcode: "firefox"}], chat_message[:emojis])
assert chat_message_two[:id] == object.id |> to_string()
assert chat_message_two[:content] == "gkgkgk"
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]
end
end