- // Verify its a mod (only mods can edit it)
- let community_id = data.community_id;
- let mods: Vec<PersonId> = blocking(context.pool(), move |conn| {
- CommunityModeratorView::for_community(conn, community_id)
- .map(|v| v.into_iter().map(|m| m.moderator.id).collect())
- })
- .await??;
- if !mods.contains(&local_user_view.person.id) {
- return Err(ApiError::err("not_a_moderator").into());
- }
-
- let community_id = data.community_id;
- let read_community = blocking(context.pool(), move |conn| {
- Community::read(conn, community_id)
- })
- .await??;
+ let title = sanitize_html_opt(&data.title);
+ let description = sanitize_html_opt(&data.description);