def fetch_activities_for_context(context) do
query = from activity in Activity,
- where: fragment("? @> ?", activity.data, ^%{ context: context })
+ where: fragment("? @> ?", activity.data, ^%{ context: context }),
+ order_by: [desc: :inserted_at]
Repo.all(query)
end
activities = ActivityPub.fetch_activities_for_context("2hu")
- assert activities == [activity, activity_two]
+ assert activities == [activity_two, activity]
end
end
statuses = TwitterAPI.fetch_conversation(user, object.id)
assert length(statuses) == 2
- assert Enum.at(statuses, 0)["id"] == activity.id
- assert Enum.at(statuses, 1)["id"] == activity_two.id
+ assert Enum.at(statuses, 1)["id"] == activity.id
+ assert Enum.at(statuses, 0)["id"] == activity_two.id
end
test "upload a file" do