|
|
@ -92,7 +92,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|
|
|
|
|
|
|
|
|
|
|
user = User.get_by_ap_id(object["actor"])
|
|
|
|
user = User.get_by_ap_id(object["actor"])
|
|
|
|
|
|
|
|
|
|
|
|
assert user.info["note_count"] == 1
|
|
|
|
assert user.info.note_count == 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
test "it works for incoming notices with hashtags" do
|
|
|
|
test "it works for incoming notices with hashtags" do
|
|
|
@ -307,7 +307,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
assert user.info["banner"]["url"] == [
|
|
|
|
assert user.info.banner["url"] == [
|
|
|
|
%{
|
|
|
|
%{
|
|
|
|
"href" =>
|
|
|
|
"href" =>
|
|
|
|
"https://cd.niu.moe/accounts/headers/000/033/323/original/850b3448fa5fd477.png"
|
|
|
|
"https://cd.niu.moe/accounts/headers/000/033/323/original/850b3448fa5fd477.png"
|
|
|
@ -337,7 +337,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|
|
|
{:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(update_data)
|
|
|
|
{:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(update_data)
|
|
|
|
|
|
|
|
|
|
|
|
user = User.get_cached_by_ap_id(data["actor"])
|
|
|
|
user = User.get_cached_by_ap_id(data["actor"])
|
|
|
|
assert user.info["locked"] == true
|
|
|
|
assert user.info.locked == true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
test "it works for incoming deletes" do
|
|
|
|
test "it works for incoming deletes" do
|
|
|
@ -543,7 +543,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|
|
|
|
|
|
|
|
|
|
|
test "it works for incoming accepts which were orphaned" do
|
|
|
|
test "it works for incoming accepts which were orphaned" do
|
|
|
|
follower = insert(:user)
|
|
|
|
follower = insert(:user)
|
|
|
|
followed = insert(:user, %{info: %{"locked" => true}})
|
|
|
|
followed = insert(:user, %{info: %User.Info{locked: true}})
|
|
|
|
|
|
|
|
|
|
|
|
{:ok, follow_activity} = ActivityPub.follow(follower, followed)
|
|
|
|
{:ok, follow_activity} = ActivityPub.follow(follower, followed)
|
|
|
|
|
|
|
|
|
|
|
@ -565,7 +565,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|
|
|
|
|
|
|
|
|
|
|
test "it works for incoming accepts which are referenced by IRI only" do
|
|
|
|
test "it works for incoming accepts which are referenced by IRI only" do
|
|
|
|
follower = insert(:user)
|
|
|
|
follower = insert(:user)
|
|
|
|
followed = insert(:user, %{info: %{"locked" => true}})
|
|
|
|
followed = insert(:user, %{info: %User.Info{locked: true}})
|
|
|
|
|
|
|
|
|
|
|
|
{:ok, follow_activity} = ActivityPub.follow(follower, followed)
|
|
|
|
{:ok, follow_activity} = ActivityPub.follow(follower, followed)
|
|
|
|
|
|
|
|
|
|
|
@ -585,7 +585,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|
|
|
|
|
|
|
|
|
|
|
test "it fails for incoming accepts which cannot be correlated" do
|
|
|
|
test "it fails for incoming accepts which cannot be correlated" do
|
|
|
|
follower = insert(:user)
|
|
|
|
follower = insert(:user)
|
|
|
|
followed = insert(:user, %{info: %{"locked" => true}})
|
|
|
|
followed = insert(:user, %{info: %User.Info{locked: true}})
|
|
|
|
|
|
|
|
|
|
|
|
accept_data =
|
|
|
|
accept_data =
|
|
|
|
File.read!("test/fixtures/mastodon-accept-activity.json")
|
|
|
|
File.read!("test/fixtures/mastodon-accept-activity.json")
|
|
|
@ -604,7 +604,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|
|
|
|
|
|
|
|
|
|
|
test "it fails for incoming rejects which cannot be correlated" do
|
|
|
|
test "it fails for incoming rejects which cannot be correlated" do
|
|
|
|
follower = insert(:user)
|
|
|
|
follower = insert(:user)
|
|
|
|
followed = insert(:user, %{info: %{"locked" => true}})
|
|
|
|
followed = insert(:user, %{info: %User.Info{locked: true}})
|
|
|
|
|
|
|
|
|
|
|
|
accept_data =
|
|
|
|
accept_data =
|
|
|
|
File.read!("test/fixtures/mastodon-reject-activity.json")
|
|
|
|
File.read!("test/fixtures/mastodon-reject-activity.json")
|
|
|
@ -623,7 +623,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|
|
|
|
|
|
|
|
|
|
|
test "it works for incoming rejects which are orphaned" do
|
|
|
|
test "it works for incoming rejects which are orphaned" do
|
|
|
|
follower = insert(:user)
|
|
|
|
follower = insert(:user)
|
|
|
|
followed = insert(:user, %{info: %{"locked" => true}})
|
|
|
|
followed = insert(:user, %{info: %User.Info{locked: true}})
|
|
|
|
|
|
|
|
|
|
|
|
{:ok, follower} = User.follow(follower, followed)
|
|
|
|
{:ok, follower} = User.follow(follower, followed)
|
|
|
|
{:ok, _follow_activity} = ActivityPub.follow(follower, followed)
|
|
|
|
{:ok, _follow_activity} = ActivityPub.follow(follower, followed)
|
|
|
@ -648,7 +648,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|
|
|
|
|
|
|
|
|
|
|
test "it works for incoming rejects which are referenced by IRI only" do
|
|
|
|
test "it works for incoming rejects which are referenced by IRI only" do
|
|
|
|
follower = insert(:user)
|
|
|
|
follower = insert(:user)
|
|
|
|
followed = insert(:user, %{info: %{"locked" => true}})
|
|
|
|
followed = insert(:user, %{info: %User.Info{locked: true}})
|
|
|
|
|
|
|
|
|
|
|
|
{:ok, follower} = User.follow(follower, followed)
|
|
|
|
{:ok, follower} = User.follow(follower, followed)
|
|
|
|
{:ok, follow_activity} = ActivityPub.follow(follower, followed)
|
|
|
|
{:ok, follow_activity} = ActivityPub.follow(follower, followed)
|
|
|
@ -815,18 +815,18 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|
|
|
assert "http://localhost:4001/users/rye@niu.moe/followers" 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
|
|
|
|
|
|
|
|
|
|
|
|
{:ok, user} = Transmogrifier.upgrade_user_from_ap_id("https://niu.moe/users/rye")
|
|
|
|
{:ok, user} = Transmogrifier.upgrade_user_from_ap_id("https://niu.moe/users/rye")
|
|
|
|
assert user.info["ap_enabled"]
|
|
|
|
assert user.info.ap_enabled
|
|
|
|
assert user.info["note_count"] == 1
|
|
|
|
assert user.info.note_count == 1
|
|
|
|
assert user.follower_address == "https://niu.moe/users/rye/followers"
|
|
|
|
assert user.follower_address == "https://niu.moe/users/rye/followers"
|
|
|
|
|
|
|
|
|
|
|
|
# Wait for the background task
|
|
|
|
# Wait for the background task
|
|
|
|
:timer.sleep(1000)
|
|
|
|
:timer.sleep(1000)
|
|
|
|
|
|
|
|
|
|
|
|
user = Repo.get(User, user.id)
|
|
|
|
user = Repo.get(User, user.id)
|
|
|
|
assert user.info["note_count"] == 1
|
|
|
|
assert user.info.note_count == 1
|
|
|
|
|
|
|
|
|
|
|
|
activity = Repo.get(Activity, activity.id)
|
|
|
|
activity = Repo.get(Activity, activity.id)
|
|
|
|
assert user.follower_address in activity.recipients
|
|
|
|
assert user.follower_address in activity.recipients
|
|
|
@ -847,7 +847,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|
|
|
"https://cdn.niu.moe/accounts/headers/000/033/323/original/850b3448fa5fd477.png"
|
|
|
|
"https://cdn.niu.moe/accounts/headers/000/033/323/original/850b3448fa5fd477.png"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|
|
|
|
} = user.info["banner"]
|
|
|
|
} = user.info.banner
|
|
|
|
|
|
|
|
|
|
|
|
refute "..." in activity.recipients
|
|
|
|
refute "..." in activity.recipients
|
|
|
|
|
|
|
|
|
|
|
|