X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Factivity_pub%2Factivity_pub.ex;h=69a2d8f4ef23c18d5d59eff3b17e1b43af602ea7;hb=140f72725dd3d2840b356107e24542ba2896e4e1;hp=74df3c469c438e7620fdedb58c7572c6c852270c;hpb=70024632ba32121bd63a439b2d708d4b4ff1a190;p=akkoma diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 74df3c469..69a2d8f4e 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, ^%{ type: "Create", context: context }), + order_by: [desc: :inserted_at] Repo.all(query) end @@ -111,7 +112,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do defp restrict_actor(query, %{"actor_id" => actor_id}) do from activity in query, - where: fragment("? @> ?", activity.data, ^%{actor: actor_id}) + where: fragment("?->>'actor' = ?", activity.data, ^actor_id) end defp restrict_actor(query, _), do: query