Commit 8eea0988 authored by lain's avatar lain
Browse files

Return directly addressed activities in friends timeline.

parent 15655d99
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment