]> Untitled Git - lemmy.git/blobdiff - crates/api_crud/src/post/read.rs
First pass at invite-only migration. (#1949)
[lemmy.git] / crates / api_crud / src / post / read.rs
index 42e84254e9930c520c6de68732f644116d374515..10ecefc38793a34d24bd87c6befd53f6de7aae08 100644 (file)
@@ -1,6 +1,12 @@
 use crate::PerformCrud;
 use actix_web::web::Data;
-use lemmy_api_common::{blocking, get_local_user_view_from_jwt_opt, mark_post_as_read, post::*};
+use lemmy_api_common::{
+  blocking,
+  check_private_instance,
+  get_local_user_view_from_jwt_opt,
+  mark_post_as_read,
+  post::*,
+};
 use lemmy_apub::{
   fetcher::webfinger::webfinger_resolve,
   objects::community::ApubCommunity,
@@ -38,6 +44,8 @@ impl PerformCrud for GetPost {
       get_local_user_view_from_jwt_opt(data.auth.as_ref(), context.pool(), context.secret())
         .await?;
 
+    check_private_instance(&local_user_view, context.pool()).await?;
+
     let show_bot_accounts = local_user_view
       .as_ref()
       .map(|t| t.local_user.show_bot_accounts);
@@ -130,6 +138,8 @@ impl PerformCrud for GetPosts {
       get_local_user_view_from_jwt_opt(data.auth.as_ref(), context.pool(), context.secret())
         .await?;
 
+    check_private_instance(&local_user_view, context.pool()).await?;
+
     let person_id = local_user_view.to_owned().map(|l| l.person.id);
 
     let show_nsfw = local_user_view.as_ref().map(|t| t.local_user.show_nsfw);