]> Untitled Git - lemmy.git/blob - crates/apub/src/protocol/activities/following/accept.rs
Fix handling of follows addressed to single value (#2920)
[lemmy.git] / crates / apub / src / protocol / activities / following / accept.rs
1 use crate::{
2   objects::{community::ApubCommunity, person::ApubPerson},
3   protocol::activities::following::follow::Follow,
4 };
5 use activitypub_federation::{
6   fetch::object_id::ObjectId,
7   kinds::activity::AcceptType,
8   protocol::helpers::deserialize_skip_error,
9 };
10 use serde::{Deserialize, Serialize};
11 use url::Url;
12
13 #[derive(Clone, Debug, Deserialize, Serialize)]
14 #[serde(rename_all = "camelCase")]
15 pub struct AcceptFollow {
16   pub(crate) actor: ObjectId<ApubCommunity>,
17   /// Optional, for compatibility with platforms that always expect recipient field
18   #[serde(deserialize_with = "deserialize_skip_error", default)]
19   pub(crate) to: Option<[ObjectId<ApubPerson>; 1]>,
20   pub(crate) object: Follow,
21   #[serde(rename = "type")]
22   pub(crate) kind: AcceptType,
23   pub(crate) id: Url,
24 }