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( query = query.filter(
comment::content comment::content
.ilike(fuzzy_search(&search_term)) .ilike(fuzzy_search(&search_term))
.and(comment::removed.eq(false)) .and(not(comment::removed.or(comment::deleted))),
.and(comment::deleted.eq(false)),
); );
}; };

View file

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