--- /dev/null
+{
+ "actor": "https://dev.narwhal.city/users/1",
+ "object": "https://beehaw.org/c/foss",
+ "to": "https://beehaw.org/c/foss",
+ "@context": "https://www.w3.org/ns/activitystreams",
+ "id": "https://dev.narwhal.city/communities/90/followers/1",
+ "type": "Follow"
+}
objects::{community::ApubCommunity, person::ApubPerson},
protocol::activities::following::follow::Follow,
};
-use activitypub_federation::{fetch::object_id::ObjectId, kinds::activity::AcceptType};
+use activitypub_federation::{
+ fetch::object_id::ObjectId,
+ kinds::activity::AcceptType,
+ protocol::helpers::deserialize_skip_error,
+};
use serde::{Deserialize, Serialize};
use url::Url;
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")]
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;
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")]
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;
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")]
#[test]
fn test_parse_lotide_activities() {
+ test_json::<Follow>("assets/lotide/activities/follow.json").unwrap();
test_json::<CreateOrUpdatePage>("assets/lotide/activities/create_page.json").unwrap();
test_json::<CreateOrUpdatePage>("assets/lotide/activities/create_page_image.json").unwrap();
test_json::<CreateOrUpdateNote>("assets/lotide/activities/create_note_reply.json").unwrap();