error::LemmyError,
utils::{
slurs::{check_slurs, check_slurs_opt},
- validation::is_valid_body_field,
+ validation::{check_site_visibility_valid, is_valid_body_field},
},
};
use url::Url;
let local_user_view = local_user_view_from_jwt(&data.auth, context).await?;
+ // Make sure user is an admin
+ is_admin(&local_user_view)?;
+
+ check_site_visibility_valid(
+ local_site.private_instance,
+ local_site.federation_enabled,
+ &data.private_instance,
+ &data.federation_enabled,
+ )?;
+
let sidebar = diesel_option_overwrite(&data.sidebar);
let description = diesel_option_overwrite(&data.description);
let icon = diesel_option_overwrite_to_url(&data.icon)?;
check_slurs(&data.name, &slur_regex)?;
check_slurs_opt(&data.description, &slur_regex)?;
- // Make sure user is an admin
- is_admin(&local_user_view)?;
-
if let Some(Some(desc)) = &description {
site_description_length_check(desc)?;
}