Dont show deleted / removed posts when searching. Fixes #4576 (#4671)

* Dont show deleted / removed posts when searching. Fixes #4576

* Address PR comments.

* Clean up comment removed also.

---------

Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
This commit is contained in:
Dessalines 2024-04-30 06:24:18 -04:00 committed by GitHub
parent b05f221565
commit 5c35e97a75
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 7 deletions

View file

@ -220,8 +220,7 @@ fn queries<'a>() -> Queries<
query = query.filter(
comment::content
.ilike(fuzzy_search(&search_term))
.and(comment::removed.eq(false))
.and(comment::deleted.eq(false)),
.and(not(comment::removed.or(comment::deleted))),
);
};

View file

@ -396,11 +396,13 @@ fn queries<'a>() -> Queries<
if let Some(search_term) = &options.search_term {
let searcher = fuzzy_search(search_term);
query = query.filter(
post::name
.ilike(searcher.clone())
.or(post::body.ilike(searcher)),
);
query = query
.filter(
post::name
.ilike(searcher.clone())
.or(post::body.ilike(searcher)),
)
.filter(not(post::removed.or(post::deleted)));
}
// If there is a content warning, show nsfw content by default.