serde(default)

This commit is contained in:
Felix Ableitner 2023-10-19 13:28:39 +02:00
parent da7a672208
commit d56afd3075
2 changed files with 3 additions and 6 deletions

View file

@ -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);
}

View file

@ -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,
}