async fn receive(self, context: &Data<Self::DataType>) -> Result<(), LemmyError> {
insert_activity(&self.id, &self, false, false, context).await?;
let (community, collection_type) =
- Community::get_by_collection_url(context.pool(), &self.target.into()).await?;
+ Community::get_by_collection_url(&mut context.pool(), &self.target.into()).await?;
match collection_type {
CollectionType::Moderators => {
let new_mod = ObjectId::<ApubPerson>::from(self.object)
// been added. Skip it here as it would result in a duplicate key error.
let new_mod_id = new_mod.id;
let moderated_communities =
- CommunityModerator::get_person_moderated_communities(context.pool(), new_mod_id).await?;
+ CommunityModerator::get_person_moderated_communities(&mut context.pool(), new_mod_id)
+ .await?;
if !moderated_communities.contains(&community.id) {
let form = CommunityModeratorForm {
community_id: community.id,
person_id: new_mod.id,
};
- CommunityModerator::join(context.pool(), &form).await?;
+ CommunityModerator::join(&mut context.pool(), &form).await?;
// write mod log
let actor = self.actor.dereference(context).await?;
community_id: community.id,
removed: Some(false),
};
- ModAddCommunity::create(context.pool(), &form).await?;
+ ModAddCommunity::create(&mut context.pool(), &form).await?;
}
// TODO: send websocket notification about added mod
}
let form = PostUpdateForm::builder()
.featured_community(Some(true))
.build();
- Post::update(context.pool(), post.id, &form).await?;
+ Post::update(&mut context.pool(), post.id, &form).await?;
}
}
Ok(())
context: &Data<LemmyContext>,
) -> Result<(), LemmyError> {
let local_user_view = local_user_view_from_jwt(&request.auth, context).await?;
- let community: ApubCommunity = Community::read(context.pool(), request.community_id)
+ let community: ApubCommunity = Community::read(&mut context.pool(), request.community_id)
.await?
.into();
- let updated_mod: ApubPerson = Person::read(context.pool(), request.person_id)
+ let updated_mod: ApubPerson = Person::read(&mut context.pool(), request.person_id)
.await?
.into();
if request.added {
context: &Data<LemmyContext>,
) -> Result<(), LemmyError> {
let local_user_view = local_user_view_from_jwt(&request.auth, context).await?;
- let community = Community::read(context.pool(), response.post_view.community.id)
+ let community = Community::read(&mut context.pool(), response.post_view.community.id)
.await?
.into();
let post = response.post_view.post.clone().into();