]> Untitled Git - lemmy.git/blobdiff - crates/apub/src/protocol/activities/following/follow.rs
Fix handling of follows addressed to single value (#2920)
[lemmy.git] / crates / apub / src / protocol / activities / following / follow.rs
index 064a36055d3259aebc4b12478cc9080eb87be789..5d5104ea6a466d73cf487f12bfcd0945e1a7e53f 100644 (file)
@@ -1,5 +1,9 @@
 use crate::{fetcher::user_or_community::UserOrCommunity, objects::person::ApubPerson};
-use activitypub_federation::{fetch::object_id::ObjectId, kinds::activity::FollowType};
+use activitypub_federation::{
+  fetch::object_id::ObjectId,
+  kinds::activity::FollowType,
+  protocol::helpers::deserialize_skip_error,
+};
 use serde::{Deserialize, Serialize};
 use url::Url;
 
@@ -8,6 +12,7 @@ use url::Url;
 pub struct Follow {
   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<UserOrCommunity>; 1]>,
   pub(crate) object: ObjectId<UserOrCommunity>,
   #[serde(rename = "type")]