self.inner
}
}
+
+#[derive(Serialize, Deserialize)]
+pub(crate) struct WithContextJson {
+ #[serde(rename = "@context")]
+ context: OneOrMany<AnyBase>,
+ inner: serde_json::Value,
+}
+
+impl WithContextJson {
+ pub(crate) fn new(inner: serde_json::Value) -> WithContextJson {
+ WithContextJson {
+ context: CONTEXT.clone(),
+ inner,
+ }
+ }
+}
use crate::{
activity_lists::SharedInboxActivities,
check_is_apub_id_valid,
- context::WithContext,
+ context::{WithContext, WithContextJson},
fetcher::user_or_community::UserOrCommunity,
http::{community::receive_group_inbox, person::receive_person_inbox},
insert_activity,
.json(WithContext::new(data))
}
+fn create_json_apub_response(data: serde_json::Value) -> HttpResponse<Body> {
+ HttpResponse::Ok()
+ .content_type(APUB_JSON_CONTENT_TYPE)
+ .json(WithContextJson::new(data))
+}
+
fn create_apub_tombstone_response<T>(data: &T) -> HttpResponse<Body>
where
T: Serialize,
if !activity.local || sensitive {
Ok(HttpResponse::NotFound().finish())
} else {
- Ok(create_apub_response(&activity.data))
+ Ok(create_json_apub_response(activity.data))
}
}