]> Untitled Git - lemmy.git/blobdiff - crates/apub/src/api/list_posts.rs
Replace Option<bool> with bool for PostQuery and CommentQuery (#3819) (#3857)
[lemmy.git] / crates / apub / src / api / list_posts.rs
index 2ebd6b766a29a842eeaa922cce356f0bcbc102e1..c43e1381e7fb5d54d2d5e40fb288b18dda7a9949 100644 (file)
@@ -34,7 +34,15 @@ pub async fn list_posts(
   } else {
     data.community_id
   };
-  let saved_only = data.saved_only;
+  let saved_only = data.saved_only.unwrap_or_default();
+
+  let liked_only = data.liked_only.unwrap_or_default();
+  let disliked_only = data.disliked_only.unwrap_or_default();
+  if liked_only && disliked_only {
+    return Err(LemmyError::from(LemmyErrorType::ContradictingFilters));
+  }
+
+  let moderator_view = data.moderator_view.unwrap_or_default();
 
   let listing_type = Some(listing_type_with_default(
     data.type_,
@@ -48,6 +56,9 @@ pub async fn list_posts(
     sort,
     community_id,
     saved_only,
+    liked_only,
+    disliked_only,
+    moderator_view,
     page,
     limit,
     ..Default::default()