diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f54a7b..bb3b9bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Deprecated `proxy_url` configuration paramter (replaced by `federation.proxy_url`). +### Fixed + +- Prevent `delete-extraneous-posts` command from removing locally-linked posts. + ## [1.14.0] - 2023-02-22 ### Added diff --git a/src/models/posts/queries.rs b/src/models/posts/queries.rs index c2fac3d..bc4d883 100644 --- a/src/models/posts/queries.rs +++ b/src/models/posts/queries.rs @@ -1177,10 +1177,10 @@ pub async fn find_extraneous_posts( AND NOT EXISTS ( SELECT 1 FROM post_link - JOIN post ON post_link.target_id = post.id + JOIN post ON post_link.source_id = post.id JOIN actor_profile ON post.author_id = actor_profile.id WHERE - post_link.source_id = ANY(context.posts) + post_link.target_id = ANY(context.posts) AND actor_profile.actor_json IS NULL ) ",