From: Roger Braun Date: Fri, 30 Jun 2017 14:30:19 +0000 (+0200) Subject: Order conversation fetches like GS does. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=d4de38e8fff3154259e08292de60900488c210d6;p=akkoma Order conversation fetches like GS does. --- diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 74df3c469..25560f4c9 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -77,7 +77,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do 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 diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/web/activity_pub/activity_pub_test.exs index 8e7473591..0dfaaa99c 100644 --- a/test/web/activity_pub/activity_pub_test.exs +++ b/test/web/activity_pub/activity_pub_test.exs @@ -75,7 +75,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do activities = ActivityPub.fetch_activities_for_context("2hu") - assert activities == [activity, activity_two] + assert activities == [activity_two, activity] end end diff --git a/test/web/twitter_api/twitter_api_test.exs b/test/web/twitter_api/twitter_api_test.exs index 4708fe093..f591bef4a 100644 --- a/test/web/twitter_api/twitter_api_test.exs +++ b/test/web/twitter_api/twitter_api_test.exs @@ -227,8 +227,8 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do 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