+ #[tracing::instrument(skip_all)]
+ async fn verify(
+ group: &Group,
+ expected_domain: &Url,
+ context: &Data<Self::DataType>,
+ ) -> Result<(), LemmyError> {
+ group.verify(expected_domain, context).await
+ }
+
+ /// Converts a `Group` to `Community`, inserts it into the database and updates moderators.
+ #[tracing::instrument(skip_all)]
+ async fn from_json(
+ group: Group,
+ context: &Data<Self::DataType>,
+ ) -> Result<ApubCommunity, LemmyError> {
+ let instance_id = fetch_instance_actor_for_object(&group.id, context).await?;
+
+ let form = Group::into_insert_form(group.clone(), instance_id);
+ let languages =
+ LanguageTag::to_language_id_multiple(group.language, &mut context.pool()).await?;
+
+ let community = Community::create(&mut context.pool(), &form).await?;
+ CommunityLanguage::update(&mut context.pool(), languages, community.id).await?;
+
+ let community: ApubCommunity = community.into();
+
+ // Fetching mods and outbox is not necessary for Lemmy to work, so ignore errors. Besides,
+ // we need to ignore these errors so that tests can work entirely offline.
+ let fetch_outbox = group.outbox.dereference(&community, context);
+
+ if let Some(moderators) = group.attributed_to {
+ let fetch_moderators = moderators.dereference(&community, context);
+ // Fetch mods and outbox in parallel
+ let res = tokio::join!(fetch_outbox, fetch_moderators);
+ res.0.map_err(|e| debug!("{}", e)).ok();
+ res.1.map_err(|e| debug!("{}", e)).ok();
+ } else {
+ fetch_outbox.await.map_err(|e| debug!("{}", e)).ok();
+ }
+
+ Ok(community)