summaryrefslogtreecommitdiffstats
path: root/server/src/api/post.rs
diff options
context:
space:
mode:
authorLyra <teromene@teromene.fr>2019-12-11 00:10:39 +0100
committerLyra <teromene@teromene.fr>2019-12-11 00:10:39 +0100
commitc19ace7e6a0350a1f257018166769957568fabe2 (patch)
tree1c435a65903be3be9962aa444cfbcaaab424cde2 /server/src/api/post.rs
parentb7d05c18a1eb74539d05da4374ee29aecb10570f (diff)
Introduce the "MaybeOptional" trait.
This trait is a generic type that allows us to get an Option from any type and from another option. It can be used to remove the ugly "do_something", "do_something_optional" that we previously had.
Diffstat (limited to 'server/src/api/post.rs')
-rw-r--r--server/src/api/post.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/server/src/api/post.rs b/server/src/api/post.rs
index 4855865b..0b54840f 100644
--- a/server/src/api/post.rs
+++ b/server/src/api/post.rs
@@ -180,7 +180,7 @@ impl Perform<GetPostResponse> for Oper<GetPost> {
let comments = CommentQueryBuilder::create(&conn)
.for_post_id(data.id)
- .my_user_id_optional(user_id)
+ .my_user_id(user_id)
.limit(9999)
.list()?;
@@ -236,10 +236,10 @@ impl Perform<GetPostsResponse> for Oper<GetPosts> {
.listing_type(type_)
.sort(&sort)
.show_nsfw(show_nsfw)
- .for_community_id_optional(data.community_id)
- .my_user_id_optional(user_id)
- .page_optional(data.page)
- .limit_optional(data.limit)
+ .for_community_id(data.community_id)
+ .my_user_id(user_id)
+ .page(data.page)
+ .limit(data.limit)
.list()
{
Ok(posts) => posts,