Use follower address in user entry.
[akkoma] / lib / pleroma / web / activity_pub / activity_pub.ex
index 74df3c469c438e7620fdedb58c7572c6c852270c..69a2d8f4ef23c18d5d59eff3b17e1b43af602ea7 100644 (file)
@@ -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