From b4276341af0adb733d802aa6732f2b6b70992207 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Mon, 22 Mar 2021 10:39:54 -0400 Subject: [PATCH] Adding saved_only to GetComments and GetPosts. Fixes #1513 --- crates/api/src/comment.rs | 2 ++ crates/api/src/local_user.rs | 1 + crates/api/src/post.rs | 3 +++ crates/api_structs/src/comment.rs | 1 + crates/api_structs/src/post.rs | 1 + 5 files changed, 8 insertions(+) diff --git a/crates/api/src/comment.rs b/crates/api/src/comment.rs index 4fd3f7b2..bcee72b0 100644 --- a/crates/api/src/comment.rs +++ b/crates/api/src/comment.rs @@ -690,12 +690,14 @@ impl Perform for GetComments { let community_id = data.community_id; let community_name = data.community_name.to_owned(); + let saved_only = data.saved_only; let page = data.page; let limit = data.limit; let comments = blocking(context.pool(), move |conn| { CommentQueryBuilder::create(conn) .listing_type(type_) .sort(&sort) + .saved_only(saved_only) .community_id(community_id) .community_name(community_name) .my_person_id(person_id) diff --git a/crates/api/src/local_user.rs b/crates/api/src/local_user.rs index 266d28ee..6aa8b26c 100644 --- a/crates/api/src/local_user.rs +++ b/crates/api/src/local_user.rs @@ -596,6 +596,7 @@ impl Perform for GetPersonDetails { .my_person_id(person_id) .sort(&sort) .saved_only(saved_only) + .community_id(community_id) .page(page) .limit(limit); diff --git a/crates/api/src/post.rs b/crates/api/src/post.rs index 9911f672..bbc3e04b 100644 --- a/crates/api/src/post.rs +++ b/crates/api/src/post.rs @@ -260,6 +260,8 @@ impl Perform for GetPosts { let limit = data.limit; let community_id = data.community_id; let community_name = data.community_name.to_owned(); + let saved_only = data.saved_only; + let posts = match blocking(context.pool(), move |conn| { PostQueryBuilder::create(conn) .listing_type(&type_) @@ -267,6 +269,7 @@ impl Perform for GetPosts { .show_nsfw(show_nsfw) .community_id(community_id) .community_name(community_name) + .saved_only(saved_only) .my_person_id(person_id) .page(page) .limit(limit) diff --git a/crates/api_structs/src/comment.rs b/crates/api_structs/src/comment.rs index f62c41aa..1457f181 100644 --- a/crates/api_structs/src/comment.rs +++ b/crates/api_structs/src/comment.rs @@ -70,6 +70,7 @@ pub struct GetComments { pub limit: Option, pub community_id: Option, pub community_name: Option, + pub saved_only: bool, pub auth: Option, } diff --git a/crates/api_structs/src/post.rs b/crates/api_structs/src/post.rs index d0991166..727859bc 100644 --- a/crates/api_structs/src/post.rs +++ b/crates/api_structs/src/post.rs @@ -49,6 +49,7 @@ pub struct GetPosts { pub limit: Option, pub community_id: Option, pub community_name: Option, + pub saved_only: bool, pub auth: Option, } -- 2.44.1