Merge branch 'develop' into 'remove-avatar-header'
[akkoma] / lib / pleroma / web / activity_pub / utils.ex
index b292d7d8d57c8de9e2af8c856aab16d34ee0fda1..10ff572a23ee11eabb60569ab8251a6c1ac980f5 100644 (file)
@@ -376,8 +376,8 @@ defmodule Pleroma.Web.ActivityPub.Utils do
   @doc """
   Updates a follow activity's state (for locked accounts).
   """
-  def update_follow_state(
-        %Activity{data: %{"actor" => actor, "object" => object, "state" => "pending"}} = activity,
+  def update_follow_state_for_all(
+        %Activity{data: %{"actor" => actor, "object" => object}} = activity,
         state
       ) do
     try do
@@ -794,10 +794,11 @@ defmodule Pleroma.Web.ActivityPub.Utils do
     query =
       from(
         [activity, object: object] in Activity.with_preloaded_object(Activity),
+        where: fragment("(?)->>'type' = 'Create'", activity.data),
         where: fragment("(?)->>'actor' = ?", activity.data, ^actor),
         where:
           fragment(
-            "(?)->'inReplyTo' = ?",
+            "(?)->>'inReplyTo' = ?",
             object.data,
             ^to_string(id)
           ),