Mastodon API: Return `pleroma.direct_conversation_id` when creating direct messages (`POST /api/v1/statuses`)
This commit is contained in:
parent
f95a2b2cda
commit
fe5e0b7846
|
@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
- Replaced [pleroma_job_queue](https://git.pleroma.social/pleroma/pleroma_job_queue) and `Pleroma.Web.Federator.RetryQueue` with [Oban](https://github.com/sorentwo/oban) (see [`docs/config.md`](docs/config.md) on migrating customized worker / retry settings)
|
- Replaced [pleroma_job_queue](https://git.pleroma.social/pleroma/pleroma_job_queue) and `Pleroma.Web.Federator.RetryQueue` with [Oban](https://github.com/sorentwo/oban) (see [`docs/config.md`](docs/config.md) on migrating customized worker / retry settings)
|
||||||
- Introduced [quantum](https://github.com/quantum-elixir/quantum-core) job scheduler
|
- Introduced [quantum](https://github.com/quantum-elixir/quantum-core) job scheduler
|
||||||
- Admin API: Return `total` when querying for reports
|
- Admin API: Return `total` when querying for reports
|
||||||
|
- Mastodon API: Return `pleroma.direct_conversation_id` when creating a direct message (`POST /api/v1/statuses`)
|
||||||
|
|
||||||
## [1.1.0] - 2019-??-??
|
## [1.1.0] - 2019-??-??
|
||||||
### Security
|
### Security
|
||||||
|
|
|
@ -611,7 +611,12 @@ def post_status(%{assigns: %{user: user}} = conn, %{"status" => _} = params) do
|
||||||
{:ok, activity} ->
|
{:ok, activity} ->
|
||||||
conn
|
conn
|
||||||
|> put_view(StatusView)
|
|> put_view(StatusView)
|
||||||
|> try_render("status.json", %{activity: activity, for: user, as: :activity})
|
|> try_render("status.json", %{
|
||||||
|
activity: activity,
|
||||||
|
for: user,
|
||||||
|
as: :activity,
|
||||||
|
with_direct_conversation_id: true
|
||||||
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -296,7 +296,9 @@ test "posting a direct status", %{conn: conn} do
|
||||||
conn
|
conn
|
||||||
|> post("api/v1/statuses", %{"status" => content, "visibility" => "direct"})
|
|> post("api/v1/statuses", %{"status" => content, "visibility" => "direct"})
|
||||||
|
|
||||||
assert %{"id" => id, "visibility" => "direct"} = json_response(conn, 200)
|
assert %{"id" => id} = response = json_response(conn, 200)
|
||||||
|
assert response["visibility"] == "direct"
|
||||||
|
assert response["pleroma"]["direct_conversation_id"]
|
||||||
assert activity = Activity.get_by_id(id)
|
assert activity = Activity.get_by_id(id)
|
||||||
assert activity.recipients == [user2.ap_id, conn.assigns[:user].ap_id]
|
assert activity.recipients == [user2.ap_id, conn.assigns[:user].ap_id]
|
||||||
assert activity.data["to"] == [user2.ap_id]
|
assert activity.data["to"] == [user2.ap_id]
|
||||||
|
|
Loading…
Reference in New Issue