- let language_id = self.language_id;
- blocking(context.pool(), move |conn| {
- CommunityLanguage::is_allowed_community_language(conn, language_id, orig_post.community_id)
- })
- .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: data.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));