mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-26 03:11:08 +00:00
Fetch community mods synchronously
This commit is contained in:
parent
298c8fa521
commit
9561fa4f44
1 changed files with 6 additions and 5 deletions
|
@ -190,10 +190,14 @@ impl Object for ApubCommunity {
|
||||||
let community = Community::insert_apub(&mut context.pool(), timestamp, &form).await?;
|
let community = Community::insert_apub(&mut context.pool(), timestamp, &form).await?;
|
||||||
CommunityLanguage::update(&mut context.pool(), languages, community.id).await?;
|
CommunityLanguage::update(&mut context.pool(), languages, community.id).await?;
|
||||||
|
|
||||||
let community: ApubCommunity = community.into();
|
// Need to fetch mods synchronously, otherwise fetching a post in community with
|
||||||
|
// `posting_restricted_to_mods` can fail if mods havent been fetched yet.
|
||||||
|
if let Some(moderators) = group.attributed_to {
|
||||||
|
moderators.dereference(&community, &context).await.ok();
|
||||||
|
}
|
||||||
|
|
||||||
// These collections are not necessary for Lemmy to work, so ignore errors.
|
// These collections are not necessary for Lemmy to work, so ignore errors.
|
||||||
let community_ = community.clone();
|
let community_: ApubCommunity = community.clone().into();
|
||||||
let context_ = context.reset_request_count();
|
let context_ = context.reset_request_count();
|
||||||
spawn_try_task(async move {
|
spawn_try_task(async move {
|
||||||
group.outbox.dereference(&community_, &context_).await.ok();
|
group.outbox.dereference(&community_, &context_).await.ok();
|
||||||
|
@ -203,9 +207,6 @@ impl Object for ApubCommunity {
|
||||||
if let Some(featured) = group.featured {
|
if let Some(featured) = group.featured {
|
||||||
featured.dereference(&community_, &context_).await.ok();
|
featured.dereference(&community_, &context_).await.ok();
|
||||||
}
|
}
|
||||||
if let Some(moderators) = group.attributed_to {
|
|
||||||
moderators.dereference(&community_, &context_).await.ok();
|
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue