1 use crate::{objects::community::ApubCommunity, protocol::IdOrNestedObject};
2 use activitypub_federation::{core::object_id::ObjectId, deser::helpers::deserialize_one_or_many};
3 use activitystreams_kinds::activity::AnnounceType;
4 use serde::{Deserialize, Serialize};
5 use serde_json::{Map, Value};
8 #[derive(Clone, Debug, Deserialize, Serialize)]
9 #[serde(rename_all = "camelCase")]
10 pub struct AnnounceActivity {
11 pub(crate) actor: ObjectId<ApubCommunity>,
12 #[serde(deserialize_with = "deserialize_one_or_many")]
13 pub(crate) to: Vec<Url>,
14 pub(crate) object: IdOrNestedObject<RawAnnouncableActivities>,
15 #[serde(deserialize_with = "deserialize_one_or_many")]
16 pub(crate) cc: Vec<Url>,
17 #[serde(rename = "type")]
18 pub(crate) kind: AnnounceType,
22 /// Use this to receive community inbox activities, and then announce them if valid. This
23 /// ensures that all json fields are kept, even if Lemmy doesnt understand them.
24 #[derive(Clone, Debug, Deserialize, Serialize)]
25 pub struct RawAnnouncableActivities {
27 pub(crate) actor: Url,
29 pub(crate) other: Map<String, Value>,