]> Untitled Git - lemmy.git/blobdiff - crates/api_crud/src/comment/read.rs
First pass at invite-only migration. (#1949)
[lemmy.git] / crates / api_crud / src / comment / read.rs
index bd1f475fd694e3e2678f55514cb1c92534c15b26..459469917e442242436ad99b40d794f7c304bc80 100644 (file)
@@ -1,6 +1,11 @@
 use crate::PerformCrud;
 use actix_web::web::Data;
-use lemmy_api_common::{blocking, comment::*, get_local_user_view_from_jwt_opt};
+use lemmy_api_common::{
+  blocking,
+  check_private_instance,
+  comment::*,
+  get_local_user_view_from_jwt_opt,
+};
 use lemmy_apub::{
   fetcher::webfinger::webfinger_resolve,
   objects::community::ApubCommunity,
@@ -31,6 +36,8 @@ impl PerformCrud for GetComment {
       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.map(|u| u.person.id);
     let id = data.id;
     let comment_view = blocking(context.pool(), move |conn| {
@@ -63,6 +70,8 @@ impl PerformCrud for GetComments {
       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);