summaryrefslogtreecommitdiffstats
path: root/server/src/api/community.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/community.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/community.rs')
-rw-r--r--server/src/api/community.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/server/src/api/community.rs b/server/src/api/community.rs
index 9492d75d..5c97f088 100644
--- a/server/src/api/community.rs
+++ b/server/src/api/community.rs
@@ -351,10 +351,10 @@ impl Perform<ListCommunitiesResponse> for Oper<ListCommunities> {
let communities = CommunityQueryBuilder::create(&conn)
.sort(&sort)
- .from_user_id_optional(user_id)
+ .from_user_id(user_id)
.show_nsfw(show_nsfw)
- .page_optional(data.page)
- .limit_optional(data.limit)
+ .page(data.page)
+ .limit(data.limit)
.list()?;
// Return the jwt