]> Untitled Git - lemmy.git/blobdiff - crates/apub/src/protocol/activities/following/undo_follow.rs
Fix handling of follows addressed to single value (#2920)
[lemmy.git] / crates / apub / src / protocol / activities / following / undo_follow.rs
index f94a9b797cce549671ebff1165ddcff2cbf5d517..aa582e99ab914903fc78910d107a036ecdd6dc61 100644 (file)
@@ -1,5 +1,9 @@
 use crate::{objects::person::ApubPerson, protocol::activities::following::follow::Follow};
-use activitypub_federation::{fetch::object_id::ObjectId, kinds::activity::UndoType};
+use activitypub_federation::{
+  fetch::object_id::ObjectId,
+  kinds::activity::UndoType,
+  protocol::helpers::deserialize_skip_error,
+};
 use serde::{Deserialize, Serialize};
 use url::Url;
 
@@ -8,6 +12,7 @@ use url::Url;
 pub struct UndoFollow {
   pub(crate) actor: ObjectId<ApubPerson>,
   /// Optional, for compatibility with platforms that always expect recipient field
+  #[serde(deserialize_with = "deserialize_skip_error", default)]
   pub(crate) to: Option<[ObjectId<ApubPerson>; 1]>,
   pub(crate) object: Follow,
   #[serde(rename = "type")]