]> Untitled Git - lemmy.git/blobdiff - crates/api/src/local_user/notifications/list_replies.rs
Replace Option<bool> with bool for PostQuery and CommentQuery (#3819) (#3857)
[lemmy.git] / crates / api / src / local_user / notifications / list_replies.rs
index 79b0fe223b6ca467b153d3f5a21a2814fd7187ff..370cd61b472535e70e78ca2ee6e8842a73ed1630 100644 (file)
@@ -20,22 +20,21 @@ impl Perform for GetReplies {
     let sort = data.sort;
     let page = data.page;
     let limit = data.limit;
-    let unread_only = data.unread_only;
+    let unread_only = data.unread_only.unwrap_or_default();
     let person_id = Some(local_user_view.person.id);
-    let show_bot_accounts = Some(local_user_view.local_user.show_bot_accounts);
+    let show_bot_accounts = local_user_view.local_user.show_bot_accounts;
 
-    let replies = CommentReplyQuery::builder()
-      .pool(&mut context.pool())
-      .recipient_id(person_id)
-      .my_person_id(person_id)
-      .sort(sort)
-      .unread_only(unread_only)
-      .show_bot_accounts(show_bot_accounts)
-      .page(page)
-      .limit(limit)
-      .build()
-      .list()
-      .await?;
+    let replies = CommentReplyQuery {
+      recipient_id: person_id,
+      my_person_id: person_id,
+      sort,
+      unread_only,
+      show_bot_accounts,
+      page,
+      limit,
+    }
+    .list(&mut context.pool())
+    .await?;
 
     Ok(GetRepliesResponse { replies })
   }