diff options
Diffstat (limited to 'server/src/api/post.rs')
-rw-r--r-- | server/src/api/post.rs | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/server/src/api/post.rs b/server/src/api/post.rs index 5df42990..e507aba3 100644 --- a/server/src/api/post.rs +++ b/server/src/api/post.rs @@ -238,21 +238,13 @@ impl Perform<GetPostsResponse> for Oper<GetPosts> { let type_ = ListingType::from_str(&data.type_)?; let sort = SortType::from_str(&data.sort)?; - let posts = match PostView::list( - &conn, - type_, - &sort, - data.community_id, - None, - None, - None, - user_id, - show_nsfw, - false, - false, - data.page, - data.limit, - ) { + let posts = match PostViewQuery::create(&conn, type_, &sort, show_nsfw, false, false) + .for_community_id_optional(data.community_id) + .my_user_id_optional(user_id) + .page_optional(data.page) + .limit_optional(data.limit) + .list() + { Ok(posts) => posts, Err(_e) => return Err(APIError::err(&self.op, "couldnt_get_posts"))?, }; |