mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-11-18 23:51:01 +00:00
More fixes to user upgrading.
This commit is contained in:
parent
efd4d04933
commit
01d5ef65fa
2 changed files with 3 additions and 3 deletions
|
@ -203,7 +203,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
||||||
data = data
|
data = data
|
||||||
|> Map.put(:info, Map.merge(user.info, data[:info]))
|
|> 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)
|
{:ok, user} = User.upgrade_changeset(user, data)
|
||||||
|> Repo.update()
|
|> Repo.update()
|
||||||
|
|
||||||
|
|
|
@ -181,12 +181,12 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
||||||
|
|
||||||
describe "user upgrade" do
|
describe "user upgrade" do
|
||||||
test "it upgrades a user to activitypub" 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]})
|
user_two = insert(:user, %{following: [user.follower_address]})
|
||||||
|
|
||||||
{:ok, activity} = CommonAPI.post(user, %{"status" => "test"})
|
{:ok, activity} = CommonAPI.post(user, %{"status" => "test"})
|
||||||
{:ok, unrelated_activity} = CommonAPI.post(user_two, %{"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)
|
user = Repo.get(User, user.id)
|
||||||
assert user.info["note_count"] == 1
|
assert user.info["note_count"] == 1
|
||||||
|
|
Loading…
Reference in a new issue