mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-23 19:31:33 +00:00
parent
3753a3bf54
commit
1a164a649e
1 changed files with 14 additions and 12 deletions
|
@ -78,18 +78,20 @@ impl Collection for ApubCommunityModerators {
|
||||||
|
|
||||||
// Add new mods to database which have been added to moderators collection
|
// Add new mods to database which have been added to moderators collection
|
||||||
for mod_id in apub.ordered_items {
|
for mod_id in apub.ordered_items {
|
||||||
let mod_user: ApubPerson = mod_id.dereference(data).await?;
|
// Ignore errors as mod accounts might be deleted or instances unavailable.
|
||||||
|
let mod_user: Option<ApubPerson> = mod_id.dereference(data).await.ok();
|
||||||
if !current_moderators
|
if let Some(mod_user) = mod_user {
|
||||||
.iter()
|
if !current_moderators
|
||||||
.map(|c| c.moderator.actor_id.clone())
|
.iter()
|
||||||
.any(|x| x == mod_user.actor_id)
|
.map(|c| c.moderator.actor_id.clone())
|
||||||
{
|
.any(|x| x == mod_user.actor_id)
|
||||||
let community_moderator_form = CommunityModeratorForm {
|
{
|
||||||
community_id: owner.id,
|
let community_moderator_form = CommunityModeratorForm {
|
||||||
person_id: mod_user.id,
|
community_id: owner.id,
|
||||||
};
|
person_id: mod_user.id,
|
||||||
CommunityModerator::join(&mut data.pool(), &community_moderator_form).await?;
|
};
|
||||||
|
CommunityModerator::join(&mut data.pool(), &community_moderator_form).await?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue