parent
221365bc9a
commit
c0aee244e7
1 changed files with 11 additions and 1 deletions
|
@ -2,7 +2,7 @@ use crate::local_user_view_from_jwt;
|
||||||
use actix_web::{error::ErrorBadRequest, web, Error, HttpRequest, HttpResponse, Result};
|
use actix_web::{error::ErrorBadRequest, web, Error, HttpRequest, HttpResponse, Result};
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use lemmy_api_common::context::LemmyContext;
|
use lemmy_api_common::{context::LemmyContext, utils::check_private_instance};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
source::{community::Community, person::Person},
|
source::{community::Community, person::Person},
|
||||||
traits::ApubActor,
|
traits::ApubActor,
|
||||||
|
@ -132,6 +132,8 @@ async fn get_feed_data(
|
||||||
) -> Result<HttpResponse, LemmyError> {
|
) -> Result<HttpResponse, LemmyError> {
|
||||||
let site_view = SiteView::read_local(&mut context.pool()).await?;
|
let site_view = SiteView::read_local(&mut context.pool()).await?;
|
||||||
|
|
||||||
|
check_private_instance(&None, &site_view.local_site)?;
|
||||||
|
|
||||||
let posts = PostQuery {
|
let posts = PostQuery {
|
||||||
listing_type: (Some(listing_type)),
|
listing_type: (Some(listing_type)),
|
||||||
sort: (Some(sort_type)),
|
sort: (Some(sort_type)),
|
||||||
|
@ -235,6 +237,8 @@ async fn get_feed_user(
|
||||||
let site_view = SiteView::read_local(&mut context.pool()).await?;
|
let site_view = SiteView::read_local(&mut context.pool()).await?;
|
||||||
let person = Person::read_from_name(&mut context.pool(), user_name, false).await?;
|
let person = Person::read_from_name(&mut context.pool(), user_name, false).await?;
|
||||||
|
|
||||||
|
check_private_instance(&None, &site_view.local_site)?;
|
||||||
|
|
||||||
let posts = PostQuery {
|
let posts = PostQuery {
|
||||||
listing_type: (Some(ListingType::All)),
|
listing_type: (Some(ListingType::All)),
|
||||||
sort: (Some(*sort_type)),
|
sort: (Some(*sort_type)),
|
||||||
|
@ -269,6 +273,8 @@ async fn get_feed_community(
|
||||||
let site_view = SiteView::read_local(&mut context.pool()).await?;
|
let site_view = SiteView::read_local(&mut context.pool()).await?;
|
||||||
let community = Community::read_from_name(&mut context.pool(), community_name, false).await?;
|
let community = Community::read_from_name(&mut context.pool(), community_name, false).await?;
|
||||||
|
|
||||||
|
check_private_instance(&None, &site_view.local_site)?;
|
||||||
|
|
||||||
let posts = PostQuery {
|
let posts = PostQuery {
|
||||||
sort: (Some(*sort_type)),
|
sort: (Some(*sort_type)),
|
||||||
community_id: (Some(community.id)),
|
community_id: (Some(community.id)),
|
||||||
|
@ -306,6 +312,8 @@ async fn get_feed_front(
|
||||||
let site_view = SiteView::read_local(&mut context.pool()).await?;
|
let site_view = SiteView::read_local(&mut context.pool()).await?;
|
||||||
let local_user = local_user_view_from_jwt(jwt, context).await?;
|
let local_user = local_user_view_from_jwt(jwt, context).await?;
|
||||||
|
|
||||||
|
check_private_instance(&Some(local_user.clone()), &site_view.local_site)?;
|
||||||
|
|
||||||
let posts = PostQuery {
|
let posts = PostQuery {
|
||||||
listing_type: (Some(ListingType::Subscribed)),
|
listing_type: (Some(ListingType::Subscribed)),
|
||||||
local_user: (Some(&local_user)),
|
local_user: (Some(&local_user)),
|
||||||
|
@ -343,6 +351,8 @@ async fn get_feed_inbox(context: &LemmyContext, jwt: &str) -> Result<ChannelBuil
|
||||||
|
|
||||||
let sort = CommentSortType::New;
|
let sort = CommentSortType::New;
|
||||||
|
|
||||||
|
check_private_instance(&Some(local_user.clone()), &site_view.local_site)?;
|
||||||
|
|
||||||
let replies = CommentReplyQuery {
|
let replies = CommentReplyQuery {
|
||||||
recipient_id: (Some(person_id)),
|
recipient_id: (Some(person_id)),
|
||||||
my_person_id: (Some(person_id)),
|
my_person_id: (Some(person_id)),
|
||||||
|
|
Loading…
Reference in a new issue