activitypub transmogrifier: better manage follow state
authorWilliam Pitcock <nenolod@dereferenced.org>
Fri, 5 Oct 2018 23:30:34 +0000 (23:30 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Fri, 5 Oct 2018 23:30:34 +0000 (23:30 +0000)
lib/pleroma/web/activity_pub/transmogrifier.ex

index aece77a5401fbe71177e1a2c584ee00163aefeba..65ac0784575c446aa67c4c15f552fc04fac1bfd3 100644 (file)
@@ -326,6 +326,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
     with actor <- get_actor(data),
          %User{} = followed <- User.get_or_fetch_by_ap_id(actor),
          {:ok, follow_activity} <- get_follow_activity(follow_object, followed),
+         {:ok, follow_activity} <- Utils.update_follow_state(follow_activity, "accept"),
          %User{local: true} = follower <- User.get_cached_by_ap_id(follow_activity.data["actor"]),
          {:ok, activity} <-
            ActivityPub.accept(%{
@@ -351,6 +352,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
     with actor <- get_actor(data),
          %User{} = followed <- User.get_or_fetch_by_ap_id(actor),
          {:ok, follow_activity} <- get_follow_activity(follow_object, followed),
+         {:ok, follow_activity} <- Utils.update_follow_state(follow_activity, "reject"),
          %User{local: true} = follower <- User.get_cached_by_ap_id(follow_activity.data["actor"]),
          {:ok, activity} <-
            ActivityPub.accept(%{