use actix_web::{web, web::Bytes, HttpRequest, HttpResponse};
use lemmy_api_common::context::LemmyContext;
use lemmy_db_schema::{source::community::Community, traits::ApubActor};
-use lemmy_utils::error::LemmyError;
+use lemmy_utils::error::{LemmyError, LemmyErrorType};
use serde::Deserialize;
#[derive(Deserialize)]
context: Data<LemmyContext>,
) -> Result<HttpResponse, LemmyError> {
let community: ApubCommunity =
- Community::read_from_name(context.pool(), &info.community_name, true)
+ Community::read_from_name(&mut context.pool(), &info.community_name, true)
.await?
.into();
info: web::Path<CommunityQuery>,
context: Data<LemmyContext>,
) -> Result<HttpResponse, LemmyError> {
- let community = Community::read_from_name(context.pool(), &info.community_name, false).await?;
+ let community =
+ Community::read_from_name(&mut context.pool(), &info.community_name, false).await?;
let followers = GroupFollowers::new(community, &context).await?;
create_apub_response(&followers)
}
context: Data<LemmyContext>,
) -> Result<HttpResponse, LemmyError> {
let community: ApubCommunity =
- Community::read_from_name(context.pool(), &info.community_name, false)
+ Community::read_from_name(&mut context.pool(), &info.community_name, false)
.await?
.into();
if community.deleted || community.removed {
- return Err(LemmyError::from_message("deleted"));
+ return Err(LemmyErrorType::Deleted)?;
}
let outbox = ApubCommunityOutbox::read_local(&community, &context).await?;
create_apub_response(&outbox)
context: Data<LemmyContext>,
) -> Result<HttpResponse, LemmyError> {
let community: ApubCommunity =
- Community::read_from_name(context.pool(), &info.community_name, false)
+ Community::read_from_name(&mut context.pool(), &info.community_name, false)
.await?
.into();
if community.deleted || community.removed {
- return Err(LemmyError::from_message("deleted"));
+ return Err(LemmyErrorType::Deleted)?;
}
let moderators = ApubCommunityModerators::read_local(&community, &context).await?;
create_apub_response(&moderators)
context: Data<LemmyContext>,
) -> Result<HttpResponse, LemmyError> {
let community: ApubCommunity =
- Community::read_from_name(context.pool(), &info.community_name, false)
+ Community::read_from_name(&mut context.pool(), &info.community_name, false)
.await?
.into();
if community.deleted || community.removed {
- return Err(LemmyError::from_message("deleted"));
+ return Err(LemmyErrorType::Deleted)?;
}
let featured = ApubCommunityFeatured::read_local(&community, &context).await?;
create_apub_response(&featured)