FIX: do not show image as category description

This commit is contained in:
Arpit Jalan 2015-10-08 19:24:15 +11:00
parent f8aca6d530
commit fa0f731427

View file

@ -393,11 +393,14 @@ class PostRevisor
body = @post.cooked
matches = body.scan(/\<p\>(.*)\<\/p\>/)
if matches && matches[0] && matches[0][0]
new_description = matches[0][0]
matches.each do |match|
next if match[0] =~ /\<img(.*)src=/ || match[0].blank?
new_description = match[0]
new_description = nil if new_description == I18n.t("category.replace_paragraph")
category.update_column(:description, new_description)
@category_changed = category
break
end
end