From edf19300e9ae87f222163f238f1a9c134f72e0a7 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 27 Oct 2021 17:50:55 -0400 Subject: [PATCH] Fixing shared inbox bug. Fixes #1865 --- api_tests/src/comment.spec.ts | 6 +++--- crates/apub/src/http/community.rs | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/api_tests/src/comment.spec.ts b/api_tests/src/comment.spec.ts index 6e51e1b63..cc51c751c 100644 --- a/api_tests/src/comment.spec.ts +++ b/api_tests/src/comment.spec.ts @@ -357,14 +357,14 @@ test('Check 3 instance shared inbox bug', async () => { // Make sure alpha sees it let alphaPost2 = await getPost(alpha, alphaPost.post.id); - // TODO remove this after - console.log(alphaPost2); expect(alphaPost2.comments[0].comment.content).toBe(commentContent); - expect(alphaPost2.comments[0].community.local).toBe(true); + expect(alphaPost2.comments[0].community.local).toBe(false); expect(alphaPost2.comments[0].creator.local).toBe(false); expect(alphaPost2.comments[0].counts.score).toBe(1); assertCommentFederation(alphaPost2.comments[0], commentRes.comment_view); + await unfollowRemotes(alpha); + await unfollowRemotes(gamma); }); test('Fetch in_reply_tos: A is unsubbed from B, B makes a post, and some embedded comments, A subs to B, B updates the lowest level comment, A fetches both the post and all the inreplyto comments for that post.', async () => { diff --git a/crates/apub/src/http/community.rs b/crates/apub/src/http/community.rs index cd75031dc..ef75ebc84 100644 --- a/crates/apub/src/http/community.rs +++ b/crates/apub/src/http/community.rs @@ -79,12 +79,6 @@ pub async fn community_inbox( receive_group_inbox(activity.clone(), request, &context).await?; - if let GroupInboxActivities::AnnouncableActivities(announcable) = activity { - let community = extract_community(&announcable.cc(), &context, &mut 0).await?; - if community.local { - AnnounceActivity::send(announcable, &community, vec![], &context).await?; - } - } Ok(HttpResponse::Ok().finish()) } @@ -93,6 +87,12 @@ pub(in crate::http) async fn receive_group_inbox( request: HttpRequest, context: &LemmyContext, ) -> Result { + if let GroupInboxActivities::AnnouncableActivities(announcable) = activity.clone() { + let community = extract_community(&announcable.cc(), context, &mut 0).await?; + if community.local { + AnnounceActivity::send(announcable, &community, vec![], context).await?; + } + } receive_activity(request, activity.clone(), context).await }