Fixing shared inbox bug. Fixes #1865

This commit is contained in:
Dessalines 2021-10-27 17:50:55 -04:00
parent 3925813f3e
commit 9a5bb8a189
2 changed files with 9 additions and 9 deletions

View file

@ -360,14 +360,14 @@ test('Check 3 instance shared inbox bug', async () => {
// Make sure alpha sees it // Make sure alpha sees it
let alphaPost2 = await getPost(alpha, alphaPost.post.id); 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].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].creator.local).toBe(false);
expect(alphaPost2.comments[0].counts.score).toBe(1); expect(alphaPost2.comments[0].counts.score).toBe(1);
assertCommentFederation(alphaPost2.comments[0], commentRes.comment_view); 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 () => { 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 () => {

View file

@ -83,12 +83,6 @@ pub async fn community_inbox(
receive_group_inbox(activity.clone(), request, &context).await?; 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()) Ok(HttpResponse::Ok().finish())
} }
@ -97,6 +91,12 @@ pub(in crate::http) async fn receive_group_inbox(
request: HttpRequest, request: HttpRequest,
context: &LemmyContext, context: &LemmyContext,
) -> Result<HttpResponse, LemmyError> { ) -> Result<HttpResponse, LemmyError> {
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 receive_activity(request, activity.clone(), context).await
} }