Fixing cross_post duplicates. Fixes #3233 (#3234)

This commit is contained in:
Dessalines 2023-06-21 04:56:44 -04:00 committed by GitHub
parent a1beccf353
commit 1ef095dd96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -91,12 +91,16 @@ impl PerformCrud for GetPost {
// Fetch the cross_posts
let cross_posts = if let Some(url) = &post_view.post.url {
PostQuery::builder()
let mut x_posts = PostQuery::builder()
.pool(context.pool())
.url_search(Some(url.inner().as_str().into()))
.build()
.list()
.await?
.await?;
// Don't return this post as one of the cross_posts
x_posts.retain(|x| x.post.id != post_id);
x_posts
} else {
Vec::new()
};