From 8eea09889b114a27eaf6ca1998b4d3ca3505ad51 Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Wed, 12 Apr 2017 16:45:23 +0200 Subject: [PATCH] Return directly addressed activities in friends timeline. --- lib/pleroma/web/twitter_api/twitter_api.ex | 2 +- test/web/twitter_api/twitter_api_test.exs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/twitter_api/twitter_api.ex b/lib/pleroma/web/twitter_api/twitter_api.ex index 0a942e880..0217b28d6 100644 --- a/lib/pleroma/web/twitter_api/twitter_api.ex +++ b/lib/pleroma/web/twitter_api/twitter_api.ex @@ -69,7 +69,7 @@ def create_status(user = %User{}, data = %{}) do end def fetch_friend_statuses(user, opts \\ %{}) do - ActivityPub.fetch_activities(user.following, opts) + ActivityPub.fetch_activities([user.ap_id | user.following], opts) |> activities_to_statuses(%{for: user}) end diff --git a/test/web/twitter_api/twitter_api_test.exs b/test/web/twitter_api/twitter_api_test.exs index ad932131a..dcb38b8b1 100644 --- a/test/web/twitter_api/twitter_api_test.exs +++ b/test/web/twitter_api/twitter_api_test.exs @@ -82,14 +82,16 @@ test "fetch public statuses" do test "fetch friends' statuses" do ActivityBuilder.public_and_non_public + {:ok, activity} = ActivityBuilder.insert(%{"to" => ["someguy/followers"]}) + {:ok, direct_activity} = ActivityBuilder.insert(%{"to" => ["some other id"]}) {:ok, user} = UserBuilder.insert(%{ap_id: "some other id", following: ["someguy/followers"]}) statuses = TwitterAPI.fetch_friend_statuses(user) activity_user = Repo.get_by(User, ap_id: activity.data["actor"]) - assert length(statuses) == 1 + assert length(statuses) == 2 assert Enum.at(statuses, 0) == ActivityRepresenter.to_map(activity, %{user: activity_user}) end