|
3 | 3 | use crate::client::json; |
4 | 4 | use crate::server::RequestExt; |
5 | 5 | use crate::subreddit::{can_access_quarantine, quarantine}; |
6 | | -use crate::utils::{error, filter_posts, get_filters, nsfw_landing, parse_post, template, Post, Preferences}; |
| 6 | +use crate::utils::{error, filter_posts, nsfw_landing, parse_post, template, Post, Preferences}; |
7 | 7 |
|
8 | 8 | use askama::Template; |
9 | 9 | use hyper::{Body, Request, Response}; |
@@ -75,7 +75,8 @@ pub async fn item(req: Request<Body>) -> Result<Response<Body>, String> { |
75 | 75 | return Ok(nsfw_landing(req, req_url).await.unwrap_or_default()); |
76 | 76 | } |
77 | 77 |
|
78 | | - let filters = get_filters(&req); |
| 78 | + let prefs = Preferences::new(&req); |
| 79 | + let filters: HashSet<String> = prefs.filters.iter().cloned().collect(); |
79 | 80 | let (duplicates, num_posts_filtered, all_posts_filtered) = parse_duplicates(&response[1], &filters).await; |
80 | 81 |
|
81 | 82 | // These are the values for the "before=", "after=", and "sort=" |
@@ -201,7 +202,7 @@ pub async fn item(req: Request<Body>) -> Result<Response<Body>, String> { |
201 | 202 | params: DuplicatesParams { before, after, sort }, |
202 | 203 | post, |
203 | 204 | duplicates, |
204 | | - prefs: Preferences::new(&req), |
| 205 | + prefs, |
205 | 206 | url: req_url, |
206 | 207 | num_posts_filtered, |
207 | 208 | all_posts_filtered, |
|
0 commit comments