TwitterAPI: Fix dm_timeline displaying only half of the conversation.
authorlain <lain@soykaf.club>
Fri, 16 Nov 2018 18:47:36 +0000 (19:47 +0100)
committerlain <lain@soykaf.club>
Fri, 16 Nov 2018 18:47:36 +0000 (19:47 +0100)
lib/pleroma/web/twitter_api/twitter_api_controller.ex
test/web/twitter_api/twitter_api_controller_test.exs

index 69e576048e00e369f57749f0655378580240a74a..cd0e2121c515553583324769c269afb30f9cf4bc 100644 (file)
@@ -130,7 +130,7 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
     query =
       ActivityPub.fetch_activities_query(
         [user.ap_id],
-        Map.merge(params, %{"type" => "Create", visibility: "direct"})
+        Map.merge(params, %{"type" => "Create", "user" => user, visibility: "direct"})
       )
 
     activities = Repo.all(query)
index 1d45d9437e6459d105f7b631fb9deadb7438f297..6bdcb4fd84ab8d35aba19767e0384e872511277b 100644 (file)
@@ -284,6 +284,12 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
           "visibility" => "direct"
         })
 
+      {:ok, direct_two} =
+        CommonAPI.post(user_two, %{
+          "status" => "Hi @#{user_one.nickname}!",
+          "visibility" => "direct"
+        })
+
       {:ok, _follower_only} =
         CommonAPI.post(user_one, %{
           "status" => "Hi @#{user_two.nickname}!",
@@ -296,8 +302,9 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
         |> assign(:user, user_two)
         |> get("/api/statuses/dm_timeline.json")
 
-      [status] = json_response(res_conn, 200)
-      assert status["id"] == direct.id
+      [status, status_two] = json_response(res_conn, 200)
+      assert status["id"] == direct_two.id
+      assert status_two["id"] == direct.id
     end
   end