X-Git-Url: http://these/git/?a=blobdiff_plain;f=crates%2Fapi_crud%2Fsrc%2Fpost%2Flist.rs;h=f7f7b2cc2fc56e97be534dc2e3cfd8dd5f34681e;hb=235cc8b22897bfb3e71ba3dbd725d36863fea8ba;hp=647d6b2948c7306495e48084da0db66e0d684685;hpb=276a8c2bd3e4fd1323e66b808675cf14cf6f75c5;p=lemmy.git diff --git a/crates/api_crud/src/post/list.rs b/crates/api_crud/src/post/list.rs index 647d6b29..f7f7b2cc 100644 --- a/crates/api_crud/src/post/list.rs +++ b/crates/api_crud/src/post/list.rs @@ -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;