forked from AkkomaGang/akkoma
Conversation: Return full status object, id is a string.
This commit is contained in:
parent
c1ebb38d3a
commit
0da985182f
2 changed files with 9 additions and 4 deletions
|
@ -1590,12 +1590,16 @@ def conversations(%{assigns: %{user: user}} = conn, params) do
|
||||||
|
|
||||||
conversations =
|
conversations =
|
||||||
Enum.map(participations, fn participation ->
|
Enum.map(participations, fn participation ->
|
||||||
|
activity = Activity.get_by_id_with_object(participation.last_activity_id)
|
||||||
|
|
||||||
|
last_status = StatusView.render("status.json", %{activity: activity, for: user})
|
||||||
|
|
||||||
%{
|
%{
|
||||||
id: participation.id,
|
id: participation.id |> to_string(),
|
||||||
# TODO: Add this.
|
# TODO: Add this.
|
||||||
accounts: [],
|
accounts: [],
|
||||||
unread: !participation.read,
|
unread: !participation.read,
|
||||||
last_status: participation.last_activity_id
|
last_status: last_status
|
||||||
}
|
}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
|
@ -334,8 +334,9 @@ test "Conversations", %{conn: conn} do
|
||||||
}
|
}
|
||||||
] = response
|
] = response
|
||||||
|
|
||||||
|
assert is_binary(res_id)
|
||||||
assert unread == true
|
assert unread == true
|
||||||
assert res_last_status == direct.id
|
assert res_last_status["id"] == direct.id
|
||||||
|
|
||||||
# Apparently undocumented API endpoint
|
# Apparently undocumented API endpoint
|
||||||
res_conn =
|
res_conn =
|
||||||
|
@ -350,7 +351,7 @@ test "Conversations", %{conn: conn} do
|
||||||
res_conn =
|
res_conn =
|
||||||
conn
|
conn
|
||||||
|> assign(:user, user_one)
|
|> assign(:user, user_one)
|
||||||
|> get("/api/v1/statuses/#{res_last_status}/context")
|
|> get("/api/v1/statuses/#{res_last_status["id"]}/context")
|
||||||
|
|
||||||
assert %{"ancestors" => [], "descendants" => []} == json_response(res_conn, 200)
|
assert %{"ancestors" => [], "descendants" => []} == json_response(res_conn, 200)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue