-use crate::{
- activity_lists::AnnouncableActivities,
- objects::community::ApubCommunity,
- protocol::{IdOrNestedObject, Unparsed},
-};
+use crate::{objects::community::ApubCommunity, protocol::IdOrNestedObject};
use activitypub_federation::{core::object_id::ObjectId, deser::helpers::deserialize_one_or_many};
use activitystreams_kinds::activity::AnnounceType;
use serde::{Deserialize, Serialize};
+use serde_json::{Map, Value};
use url::Url;
#[derive(Clone, Debug, Deserialize, Serialize)]
pub(crate) actor: ObjectId<ApubCommunity>,
#[serde(deserialize_with = "deserialize_one_or_many")]
pub(crate) to: Vec<Url>,
- pub(crate) object: IdOrNestedObject<AnnouncableActivities>,
+ pub(crate) object: IdOrNestedObject<RawAnnouncableActivities>,
#[serde(deserialize_with = "deserialize_one_or_many")]
pub(crate) cc: Vec<Url>,
#[serde(rename = "type")]
pub(crate) kind: AnnounceType,
pub(crate) id: Url,
+}
+/// Use this to receive community inbox activities, and then announce them if valid. This
+/// ensures that all json fields are kept, even if Lemmy doesnt understand them.
+#[derive(Clone, Debug, Deserialize, Serialize)]
+pub struct RawAnnouncableActivities {
+ pub(crate) id: Url,
+ pub(crate) actor: Url,
#[serde(flatten)]
- pub(crate) unparsed: Unparsed,
+ pub(crate) other: Map<String, Value>,
}