async fn perform(&self, context: &Data<LemmyContext>) -> Result<CommunityResponse, LemmyError> {
let data: &EditCommunity = self;
let local_user_view = local_user_view_from_jwt(&data.auth, context).await?;
- let local_site = LocalSite::read(context.pool()).await?;
+ let local_site = LocalSite::read(&mut context.pool()).await?;
let icon = diesel_option_overwrite_to_url(&data.icon)?;
let banner = diesel_option_overwrite_to_url(&data.banner)?;
// Verify its a mod (only mods can edit it)
let community_id = data.community_id;
- let mods: Vec<PersonId> = CommunityModeratorView::for_community(context.pool(), community_id)
- .await
- .map(|v| v.into_iter().map(|m| m.moderator.id).collect())?;
+ let mods: Vec<PersonId> =
+ CommunityModeratorView::for_community(&mut context.pool(), community_id)
+ .await
+ .map(|v| v.into_iter().map(|m| m.moderator.id).collect())?;
if !mods.contains(&local_user_view.person.id) {
return Err(LemmyErrorType::NotAModerator)?;
}
let community_id = data.community_id;
if let Some(languages) = data.discussion_languages.clone() {
- let site_languages = SiteLanguage::read_local_raw(context.pool()).await?;
+ let site_languages = SiteLanguage::read_local_raw(&mut context.pool()).await?;
// check that community languages are a subset of site languages
// https://stackoverflow.com/a/64227550
let is_subset = languages.iter().all(|item| site_languages.contains(item));
if !is_subset {
return Err(LemmyErrorType::LanguageNotAllowed)?;
}
- CommunityLanguage::update(context.pool(), languages, community_id).await?;
+ CommunityLanguage::update(&mut context.pool(), languages, community_id).await?;
}
let community_form = CommunityUpdateForm::builder()
.build();
let community_id = data.community_id;
- Community::update(context.pool(), community_id, &community_form)
+ Community::update(&mut context.pool(), community_id, &community_form)
.await
.with_lemmy_type(LemmyErrorType::CouldntUpdateCommunity)?;