From: Felix Date: Tue, 5 May 2020 14:30:13 +0000 (+0200) Subject: Federate community category and nsfw X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/readmes/%22https:/hacktivis.me/%7BpictshareAvatarThumbnail%28mod.avatar%29%7D?a=commitdiff_plain;h=dfd6629a6fc1fa43abf2815e9b219c3c0e832072;p=lemmy.git Federate community category and nsfw --- diff --git a/server/src/api/mod.rs b/server/src/api/mod.rs index 8bc03fee..9112a3be 100644 --- a/server/src/api/mod.rs +++ b/server/src/api/mod.rs @@ -23,8 +23,8 @@ use crate::{ }; use crate::apub::{ + extensions::signatures::generate_actor_keypair, fetcher::search_by_apub_id, - signatures::generate_actor_keypair, {make_apub_endpoint, ActorType, ApubLikeableType, ApubObjectType, EndpointType}, }; use crate::settings::Settings; diff --git a/server/src/apub/community.rs b/server/src/apub/community.rs index feffa70e..f7cd213d 100644 --- a/server/src/apub/community.rs +++ b/server/src/apub/community.rs @@ -51,7 +51,14 @@ impl ToApub for Community { .set_endpoints(endpoint_props)? .set_followers(self.get_followers_url())?; - Ok(group.extend(actor_props).extend(self.get_public_key_ext())) + let group_extension = GroupExtension::new(conn, self.category_id, self.nsfw)?; + + Ok( + group + .extend(group_extension) + .extend(actor_props) + .extend(self.get_public_key_ext()), + ) } fn to_tombstone(&self) -> Result { @@ -304,7 +311,8 @@ impl FromApub for CommunityForm { /// Parse an ActivityPub group received from another instance into a Lemmy community. fn from_apub(group: &GroupExt, conn: &PgConnection) -> Result { - let oprops = &group.base.base.object_props; + let group_extensions: &GroupExtension = &group.base.base.extension; + let oprops = &group.base.base.base.object_props; let aprops = &group.base.extension; let public_key: &PublicKey = &group.extension.public_key; @@ -325,7 +333,7 @@ impl FromApub for CommunityForm { // TODO: should be parsed as html and tags like