fix after merge

add_federation_worker_index
phiresky 2023-09-21 12:01:22 +00:00
parent 5941dc2924
commit 31f3677270
3 changed files with 11 additions and 16 deletions

View File

@ -504,8 +504,7 @@ test("A and G subscribe to B (center) A posts, G mentions B, it gets announced t
expect(alphaPost.post_view.community.local).toBe(true); expect(alphaPost.post_view.community.local).toBe(true);
// Make sure gamma sees it // Make sure gamma sees it
let gammaPost = (await resolvePost(gamma, alphaPost.post_view.post, false))! let gammaPost = (await resolvePost(gamma, alphaPost.post_view.post))!.post;
.post;
if (!gammaPost) { if (!gammaPost) {
throw "Missing gamma post"; throw "Missing gamma post";
@ -670,8 +669,8 @@ test("Fetch in_reply_tos: A is unsubbed from B, B makes a post, and some embedde
expect(updateRes.comment_view.comment.content).toBe(updatedCommentContent); expect(updateRes.comment_view.comment.content).toBe(updatedCommentContent);
// Get the post from alpha // Get the post from alpha
let alphaPostB = (await resolvePost(alpha, postOnBetaRes.post_view.post)) let alphaPostB = await waitForPost(alpha, postOnBetaRes.post_view.post);
.post;
if (!alphaPostB) { if (!alphaPostB) {
throw "Missing alpha post B"; throw "Missing alpha post B";
} }

View File

@ -240,7 +240,7 @@ test("Admin actions in remote community are not federated to origin", async () =
expect(banRes.banned).toBe(true); expect(banRes.banned).toBe(true);
// ban doesnt federate to community's origin instance alpha // ban doesnt federate to community's origin instance alpha
let alphaPost = (await resolvePost(alpha, gammaPost.post, false)).post; let alphaPost = (await resolvePost(alpha, gammaPost.post)).post;
expect(alphaPost?.creator_banned_from_community).toBe(false); expect(alphaPost?.creator_banned_from_community).toBe(false);
// and neither to gamma // and neither to gamma
@ -352,8 +352,7 @@ test("User blocks instance, communities are hidden", async () => {
expect(postRes.post_view.post.id).toBeDefined(); expect(postRes.post_view.post.id).toBeDefined();
// fetch post to alpha // fetch post to alpha
let alphaPost = (await resolvePost(alpha, postRes.post_view.post, false)) let alphaPost = (await resolvePost(alpha, postRes.post_view.post)).post!;
.post!;
expect(alphaPost.post).toBeDefined(); expect(alphaPost.post).toBeDefined();
// post should be included in listing // post should be included in listing

View File

@ -192,8 +192,7 @@ test("Sticky a post", async () => {
expect(betaPost2?.post.featured_community).toBe(false); expect(betaPost2?.post.featured_community).toBe(false);
// Make sure that gamma cannot sticky the post on beta // Make sure that gamma cannot sticky the post on beta
let gammaPost = (await resolvePost(gamma, postRes.post_view.post, false)) let gammaPost = (await resolvePost(gamma, postRes.post_view.post)).post;
.post;
if (!gammaPost) { if (!gammaPost) {
throw "Missing gamma post"; throw "Missing gamma post";
} }
@ -300,8 +299,7 @@ test("Remove a post from admin and community on different instance", async () =>
} }
let postRes = await createPost(gamma, gammaCommunity.id); let postRes = await createPost(gamma, gammaCommunity.id);
let alphaPost = (await resolvePost(alpha, postRes.post_view.post, false)) let alphaPost = (await resolvePost(alpha, postRes.post_view.post)).post;
.post;
if (!alphaPost) { if (!alphaPost) {
throw "Missing alpha post"; throw "Missing alpha post";
} }
@ -310,7 +308,7 @@ test("Remove a post from admin and community on different instance", async () =>
expect(removedPost.post_view.post.name).toBe(postRes.post_view.post.name); expect(removedPost.post_view.post.name).toBe(postRes.post_view.post.name);
// Make sure lemmy beta sees post is NOT removed // Make sure lemmy beta sees post is NOT removed
let betaPost = (await resolvePost(beta, postRes.post_view.post, false)).post; let betaPost = (await resolvePost(beta, postRes.post_view.post)).post;
if (!betaPost) { if (!betaPost) {
throw "Missing beta post"; throw "Missing beta post";
} }
@ -504,7 +502,7 @@ test("A and G subscribe to B (center) A posts, it gets announced to G", async ()
let postRes = await createPost(alpha, betaCommunity.community.id); let postRes = await createPost(alpha, betaCommunity.community.id);
expect(postRes.post_view.post).toBeDefined(); expect(postRes.post_view.post).toBeDefined();
let betaPost = (await resolvePost(gamma, postRes.post_view.post, false)).post; let betaPost = (await resolvePost(gamma, postRes.post_view.post)).post;
expect(betaPost?.post.name).toBeDefined(); expect(betaPost?.post.name).toBeDefined();
}); });
@ -517,8 +515,7 @@ test("Report a post", async () => {
let postRes = await createPost(beta, betaCommunity.community.id); let postRes = await createPost(beta, betaCommunity.community.id);
expect(postRes.post_view.post).toBeDefined(); expect(postRes.post_view.post).toBeDefined();
let alphaPost = (await resolvePost(alpha, postRes.post_view.post, false)) let alphaPost = (await resolvePost(alpha, postRes.post_view.post)).post;
.post;
if (!alphaPost) { if (!alphaPost) {
throw "Missing alpha post"; throw "Missing alpha post";
} }
@ -563,7 +560,7 @@ test("Sanitize HTML", async () => {
"<script>alert('xss');</script> hello &"'", "<script>alert('xss');</script> hello &"'",
); );
let alphaPost = (await resolvePost(alpha, post.post_view.post, false)).post; let alphaPost = (await resolvePost(alpha, post.post_view.post)).post;
// second escaping over federation, avoid double escape of & // second escaping over federation, avoid double escape of &
expect(alphaPost?.post.body).toBe( expect(alphaPost?.post.body).toBe(
"<script>alert('xss');</script> hello &"'", "<script>alert('xss');</script> hello &"'",