Merge branch 'bugfix/dm-timeline-scope' into 'develop'

TwitterAPI: Fix dm_timeline displaying only half of the conversation.

See merge request pleroma/pleroma!457
This commit is contained in:
kaniini 2018-11-16 23:34:43 +00:00
commit e4f57f89de
2 changed files with 10 additions and 3 deletions

View File

@ -130,7 +130,7 @@ def dm_timeline(%{assigns: %{user: user}} = conn, params) do
query = query =
ActivityPub.fetch_activities_query( ActivityPub.fetch_activities_query(
[user.ap_id], [user.ap_id],
Map.merge(params, %{"type" => "Create", visibility: "direct"}) Map.merge(params, %{"type" => "Create", "user" => user, visibility: "direct"})
) )
activities = Repo.all(query) activities = Repo.all(query)

View File

@ -284,6 +284,12 @@ test "it show direct messages", %{conn: conn} do
"visibility" => "direct" "visibility" => "direct"
}) })
{:ok, direct_two} =
CommonAPI.post(user_two, %{
"status" => "Hi @#{user_one.nickname}!",
"visibility" => "direct"
})
{:ok, _follower_only} = {:ok, _follower_only} =
CommonAPI.post(user_one, %{ CommonAPI.post(user_one, %{
"status" => "Hi @#{user_two.nickname}!", "status" => "Hi @#{user_two.nickname}!",
@ -296,8 +302,9 @@ test "it show direct messages", %{conn: conn} do
|> assign(:user, user_two) |> assign(:user, user_two)
|> get("/api/statuses/dm_timeline.json") |> get("/api/statuses/dm_timeline.json")
[status] = json_response(res_conn, 200) [status, status_two] = json_response(res_conn, 200)
assert status["id"] == direct.id assert status["id"] == direct_two.id
assert status_two["id"] == direct.id
end end
end end