]> Untitled Git - lemmy.git/blobdiff - crates/api_crud/src/post/list.rs
Moving settings to Database. (#2492)
[lemmy.git] / crates / api_crud / src / post / list.rs
index 647d6b2948c7306495e48084da0db66e0d684685..f7f7b2cc2fc56e97be534dc2e3cfd8dd5f34681e 100644 (file)
@@ -10,7 +10,10 @@ use lemmy_api_common::{
   },
 };
 use lemmy_apub::{fetcher::resolve_actor_identifier, objects::community::ApubCommunity};
-use lemmy_db_schema::{source::community::Community, traits::DeleteableOrRemoveable};
+use lemmy_db_schema::{
+  source::{community::Community, local_site::LocalSite},
+  traits::DeleteableOrRemoveable,
+};
 use lemmy_db_views::post_view::PostQuery;
 use lemmy_utils::{error::LemmyError, ConnectionId};
 use lemmy_websocket::LemmyContext;
@@ -29,13 +32,14 @@ impl PerformCrud for GetPosts {
     let local_user_view =
       get_local_user_view_from_jwt_opt(data.auth.as_ref(), context.pool(), context.secret())
         .await?;
+    let local_site = blocking(context.pool(), LocalSite::read).await??;
 
-    check_private_instance(&local_user_view, context.pool()).await?;
+    check_private_instance(&local_user_view, &local_site)?;
 
     let is_logged_in = local_user_view.is_some();
 
     let sort = data.sort;
-    let listing_type = listing_type_with_site_default(data.type_, context.pool()).await?;
+    let listing_type = listing_type_with_site_default(data.type_, &local_site)?;
 
     let page = data.page;
     let limit = data.limit;