Merge remote-tracking branch 'upstream/develop' into develop
[akkoma] / test / pleroma / web / activity_pub / utils_test.exs
index 83668caa4c676e05e82a0606f4d4a6c3963bea33..62dc02f61fe66105445ea62ac3c7c4bf5857e940 100644 (file)
@@ -1,5 +1,5 @@
 # Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Web.ActivityPub.UtilsTest do
@@ -213,6 +213,20 @@ defmodule Pleroma.Web.ActivityPub.UtilsTest do
       assert refresh_record(follow_activity).data["state"] == "accept"
       assert refresh_record(follow_activity_two).data["state"] == "accept"
     end
+
+    test "also updates the state of accepted follows" do
+      user = insert(:user)
+      follower = insert(:user)
+
+      {:ok, _, _, follow_activity} = CommonAPI.follow(follower, user)
+      {:ok, _, _, follow_activity_two} = CommonAPI.follow(follower, user)
+
+      {:ok, follow_activity_two} =
+        Utils.update_follow_state_for_all(follow_activity_two, "reject")
+
+      assert refresh_record(follow_activity).data["state"] == "reject"
+      assert refresh_record(follow_activity_two).data["state"] == "reject"
+    end
   end
 
   describe "update_follow_state/2" do