More fixes to user upgrading.
authorlain <lain@soykaf.club>
Sat, 24 Feb 2018 09:42:47 +0000 (10:42 +0100)
committerlain <lain@soykaf.club>
Sat, 24 Feb 2018 09:42:47 +0000 (10:42 +0100)
lib/pleroma/web/activity_pub/transmogrifier.ex
test/web/activity_pub/transmogrifier_test.exs

index fcf3804d50328191deaeb810b5f9634594990846..62c2290500788d0b5681b0d01847c568138d7c1d 100644 (file)
@@ -203,7 +203,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
       data = data
       |> Map.put(:info, Map.merge(user.info, data[:info]))
 
-      old_follower_address = user.follower_address
+      old_follower_address = User.ap_followers(user)
       {:ok, user} = User.upgrade_changeset(user, data)
       |> Repo.update()
 
index e3a170e4ef5ccfccb3b597a157b62c4c53ec7b0f..297d48f425ec8dd3d09129436249b0f410cf5c7c 100644 (file)
@@ -181,12 +181,12 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
 
   describe "user upgrade" do
     test "it upgrades a user to activitypub" do
-      user = insert(:user, %{local: false, ap_id: "https://niu.moe/users/rye", follower_address: "..."})
+      user = insert(:user, %{nickname: "rye@niu.moe", local: false, ap_id: "https://niu.moe/users/rye", follower_address: User.ap_followers(%User{nickname: "rye@niu.moe"})})
       user_two = insert(:user, %{following: [user.follower_address]})
 
       {:ok, activity} = CommonAPI.post(user, %{"status" => "test"})
       {:ok, unrelated_activity} = CommonAPI.post(user_two, %{"status" => "test"})
-      assert "..." in activity.recipients
+      assert "http://localhost:4001/users/rye@niu.moe/followers" in activity.recipients
 
       user = Repo.get(User, user.id)
       assert user.info["note_count"] == 1