use instance_actor_id_from_url()

This commit is contained in:
Felix Ableitner 2022-04-13 13:40:43 +02:00 committed by Dessalines
parent a2349d3e6a
commit 9217b309a7

View file

@ -6,7 +6,10 @@ use lemmy_api_common::{
community::*,
get_local_user_view_from_jwt_opt,
};
use lemmy_apub::{fetcher::resolve_actor_identifier, objects::community::ApubCommunity};
use lemmy_apub::{
fetcher::resolve_actor_identifier,
objects::{community::ApubCommunity, instance::instance_actor_id_from_url},
};
use lemmy_db_schema::{
from_opt_str_to_opt_enum,
source::{community::Community, site::Site},
@ -20,7 +23,6 @@ use lemmy_db_views_actor::{
};
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_websocket::{messages::GetCommunityUsersOnline, LemmyContext};
use url::Url;
#[async_trait::async_trait(?Send)]
impl PerformCrud for GetCommunity {
@ -76,8 +78,7 @@ impl PerformCrud for GetCommunity {
.await
.unwrap_or(1);
let mut site_id: Url = community_view.community.actor_id.clone().into();
site_id.set_path("");
let site_id = instance_actor_id_from_url(community_view.community.actor_id.clone().into());
let mut site: Option<Site> = blocking(context.pool(), move |conn| {
Site::read_from_apub_id(conn, site_id)
})