]> Untitled Git - lemmy.git/blobdiff - crates/apub/src/activities/mod.rs
Moving settings to Database. (#2492)
[lemmy.git] / crates / apub / src / activities / mod.rs
index 8205967f72ddf13e8de4c5a8dc602a946d6ddb39..0c013fbe33a3b16148e6bfc6e24311b5cf1be633 100644 (file)
@@ -14,7 +14,10 @@ use activitypub_federation::{
 use activitystreams_kinds::public;
 use anyhow::anyhow;
 use lemmy_api_common::utils::blocking;
-use lemmy_db_schema::{newtypes::CommunityId, source::community::Community};
+use lemmy_db_schema::{
+  newtypes::CommunityId,
+  source::{community::Community, local_site::LocalSite},
+};
 use lemmy_db_views_actor::structs::{CommunityPersonBanView, CommunityView};
 use lemmy_utils::error::LemmyError;
 use lemmy_websocket::LemmyContext;
@@ -167,9 +170,14 @@ where
   ActorT: Actor + ActorType,
   Activity: ActivityHandler<Error = LemmyError>,
 {
-  if !context.settings().federation.enabled {
+  let federation_enabled = blocking(context.pool(), &LocalSite::read)
+    .await?
+    .map(|l| l.federation_enabled)
+    .unwrap_or(false);
+  if !federation_enabled {
     return Ok(());
   }
+
   info!("Sending activity {}", activity.id().to_string());
   let activity = WithContext::new(activity, CONTEXT.deref().clone());