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