use crate::PerformCrud;
use actix_web::web::Data;
use lemmy_api_common::{blocking, community::*, get_local_user_view_from_jwt_opt};
-use lemmy_db_queries::{
- from_opt_str_to_opt_enum,
- source::community::Community_,
- ListingType,
- SortType,
-};
+use lemmy_apub::{build_actor_id_from_shortname, EndpointType};
+use lemmy_db_queries::{from_opt_str_to_opt_enum, ApubObject, ListingType, SortType};
use lemmy_db_schema::source::community::*;
use lemmy_db_views_actor::{
community_moderator_view::CommunityModeratorView,
Some(id) => id,
None => {
let name = data.name.to_owned().unwrap_or_else(|| "main".to_string());
+ let community_actor_id = build_actor_id_from_shortname(EndpointType::Community, &name)?;
+
blocking(context.pool(), move |conn| {
- Community::read_from_name(conn, &name)
+ Community::read_from_apub_id(conn, &community_actor_id)
})
.await?
.map_err(|_| ApiError::err("couldnt_find_community"))?