From d56afd3075a3baccb2b0eda1cc739406b83963aa Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Thu, 19 Oct 2023 13:28:39 +0200 Subject: [PATCH] serde(default) --- crates/api/src/post/mark_read.rs | 6 +----- crates/api_common/src/post.rs | 3 ++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/crates/api/src/post/mark_read.rs b/crates/api/src/post/mark_read.rs index a46e949fa..b451986c1 100644 --- a/crates/api/src/post/mark_read.rs +++ b/crates/api/src/post/mark_read.rs @@ -11,11 +11,7 @@ pub async fn mark_post_as_read( context: Data, local_user_view: LocalUserView, ) -> Result, LemmyError> { - let mut post_ids = HashSet::new(); - if let Some(post_ids_) = &data.post_ids { - post_ids.extend(post_ids_.iter().cloned()); - } - + let mut post_ids = data.post_ids.iter().cloned().collect::>(); if let Some(post_id) = data.post_id { post_ids.insert(post_id); } diff --git a/crates/api_common/src/post.rs b/crates/api_common/src/post.rs index b93742bea..c8640d51b 100644 --- a/crates/api_common/src/post.rs +++ b/crates/api_common/src/post.rs @@ -143,7 +143,8 @@ pub struct RemovePost { pub struct MarkPostAsRead { /// TODO: deprecated, send `post_ids` instead pub post_id: Option, - pub post_ids: Option>, + #[serde(default)] + pub post_ids: Vec, pub read: bool, }