mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-05-20 10:48:05 +00:00
09099e7b90
* Fix handling of follows addressed to single value * Switch to deserialize_skip_error for Follow to * Also use deserialize_skip_error for AcceptFollow and UndoFollow * actually import deserialize_skip_error
25 lines
784 B
Rust
25 lines
784 B
Rust
use crate::{
|
|
objects::{community::ApubCommunity, person::ApubPerson},
|
|
protocol::activities::following::follow::Follow,
|
|
};
|
|
use activitypub_federation::{
|
|
fetch::object_id::ObjectId,
|
|
kinds::activity::AcceptType,
|
|
protocol::helpers::deserialize_skip_error,
|
|
};
|
|
use serde::{Deserialize, Serialize};
|
|
use url::Url;
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct AcceptFollow {
|
|
pub(crate) actor: ObjectId<ApubCommunity>,
|
|
/// 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")]
|
|
pub(crate) kind: AcceptType,
|
|
pub(crate) id: Url,
|
|
}
|