serde(default)

pull/4055/head
Felix Ableitner 8 months ago
parent da7a672208
commit d56afd3075

@ -11,11 +11,7 @@ pub async fn mark_post_as_read(
context: Data<LemmyContext>,
local_user_view: LocalUserView,
) -> Result<Json<SuccessResponse>, 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::<HashSet<_>>();
if let Some(post_id) = data.post_id {
post_ids.insert(post_id);
}

@ -143,7 +143,8 @@ pub struct RemovePost {
pub struct MarkPostAsRead {
/// TODO: deprecated, send `post_ids` instead
pub post_id: Option<PostId>,
pub post_ids: Option<Vec<PostId>>,
#[serde(default)]
pub post_ids: Vec<PostId>,
pub read: bool,
}

Loading…
Cancel
Save