- let language_id = Some(
- data.language_id.unwrap_or(
- blocking(context.pool(), move |conn| {
- Language::read_undetermined(conn)
- })
- .await??,
- ),
- );
-
- let post_form = PostForm {
- creator_id: orig_post.creator_id.to_owned(),
- community_id: orig_post.community_id,
- name: data.name.to_owned().unwrap_or(orig_post.name),
- url,
- body,
- nsfw: data.nsfw,
- updated: Some(naive_now()),
- embed_title,
- embed_description,
- embed_video_url,
- language_id,
- thumbnail_url: Some(thumbnail_url),
- ..PostForm::default()
- };
+ let name = sanitize_html_opt(&data.name);
+ let body = sanitize_html_opt(&data.body);
+ let body = diesel_option_overwrite(body);
+ let embed_title = embed_title.map(|e| sanitize_html_opt(&e));
+ let embed_description = embed_description.map(|e| sanitize_html_opt(&e));