owner: &Self::Owner,
data: &Data<Self::DataType>,
) -> Result<Self::Kind, LemmyError> {
- let moderators = CommunityModeratorView::for_community(data.pool(), owner.id).await?;
+ let moderators = CommunityModeratorView::for_community(&mut data.pool(), owner.id).await?;
let ordered_items = moderators
.into_iter()
.map(|m| ObjectId::<ApubPerson>::from(m.moderator.actor_id))
) -> Result<Self, LemmyError> {
let community_id = owner.id;
let current_moderators =
- CommunityModeratorView::for_community(data.pool(), community_id).await?;
+ CommunityModeratorView::for_community(&mut data.pool(), community_id).await?;
// Remove old mods from database which arent in the moderators collection anymore
for mod_user in ¤t_moderators {
let mod_id = ObjectId::from(mod_user.moderator.actor_id.clone());
community_id: mod_user.community.id,
person_id: mod_user.moderator.id,
};
- CommunityModerator::leave(data.pool(), &community_moderator_form).await?;
+ CommunityModerator::leave(&mut data.pool(), &community_moderator_form).await?;
}
}
community_id: owner.id,
person_id: mod_user.id,
};
- CommunityModerator::join(data.pool(), &community_moderator_form).await?;
+ CommunityModerator::join(&mut data.pool(), &community_moderator_form).await?;
}
}
let community = parse_lemmy_community(&context).await;
let community_id = community.id;
- let inserted_instance = Instance::read_or_create(context.pool(), "my_domain.tld".to_string())
- .await
- .unwrap();
+ let inserted_instance =
+ Instance::read_or_create(&mut context.pool(), "my_domain.tld".to_string())
+ .await
+ .unwrap();
let old_mod = PersonInsertForm::builder()
.name("holly".into())
.instance_id(inserted_instance.id)
.build();
- let old_mod = Person::create(context.pool(), &old_mod).await.unwrap();
+ let old_mod = Person::create(&mut context.pool(), &old_mod).await.unwrap();
let community_moderator_form = CommunityModeratorForm {
community_id: community.id,
person_id: old_mod.id,
};
- CommunityModerator::join(context.pool(), &community_moderator_form)
+ CommunityModerator::join(&mut context.pool(), &community_moderator_form)
.await
.unwrap();
.unwrap();
assert_eq!(context.request_count(), 0);
- let current_moderators = CommunityModeratorView::for_community(context.pool(), community_id)
- .await
- .unwrap();
+ let current_moderators =
+ CommunityModeratorView::for_community(&mut context.pool(), community_id)
+ .await
+ .unwrap();
assert_eq!(current_moderators.len(), 1);
assert_eq!(current_moderators[0].moderator.id, new_mod.id);
- Person::delete(context.pool(), old_mod.id).await.unwrap();
- Person::delete(context.pool(), new_mod.id).await.unwrap();
- Community::delete(context.pool(), community.id)
+ Person::delete(&mut context.pool(), old_mod.id)
+ .await
+ .unwrap();
+ Person::delete(&mut context.pool(), new_mod.id)
+ .await
+ .unwrap();
+ Community::delete(&mut context.pool(), community.id)
.await
.unwrap();
- Site::delete(context.pool(), site.id).await.unwrap();
- Instance::delete(context.pool(), inserted_instance.id)
+ Site::delete(&mut context.pool(), site.id).await.unwrap();
+ Instance::delete(&mut context.pool(), inserted_instance.id)
.await
.unwrap();
}