Commit 01d5ef65 authored by lain's avatar lain

More fixes to user upgrading.

parent efd4d049
Pipeline #818 failed with stage
in 2 minutes and 7 seconds
......@@ -203,7 +203,7 @@ def upgrade_user_from_ap_id(ap_id) 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()
......
......@@ -181,12 +181,12 @@ test "it sets the 'attributedTo' property to the actor of the object if it doesn
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment