]> Untitled Git - lemmy.git/blob - 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
1 use crate::{fetcher::user_or_community::UserOrCommunity, objects::person::ApubPerson};
2 use activitypub_federation::{
3   fetch::object_id::ObjectId,
4   kinds::activity::FollowType,
5   protocol::helpers::deserialize_skip_error,
6 };
7 use serde::{Deserialize, Serialize};
8 use url::Url;
9
10 #[derive(Clone, Debug, Deserialize, Serialize)]
11 #[serde(rename_all = "camelCase")]
12 pub struct Follow {
13   pub(crate) actor: ObjectId<ApubPerson>,
14   /// Optional, for compatibility with platforms that always expect recipient field
15   #[serde(deserialize_with = "deserialize_skip_error", default)]
16   pub(crate) to: Option<[ObjectId<UserOrCommunity>; 1]>,
17   pub(crate) object: ObjectId<UserOrCommunity>,
18   #[serde(rename = "type")]
19   pub(crate) kind: FollowType,
20   pub(crate) id: Url,
21 }