mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Merge pull request #4960 from discourse/category-description-error
FIX: Explicit error when category description post is bad
This commit is contained in:
@@ -442,11 +442,13 @@ class PostRevisor
|
||||
doc = Nokogiri::HTML.fragment(@post.cooked)
|
||||
doc.css("img").remove
|
||||
|
||||
html = doc.css("p").first.inner_html.strip
|
||||
new_description = html unless html.starts_with?(Category.post_template[0..50])
|
||||
|
||||
category.update_column(:description, new_description)
|
||||
@category_changed = category
|
||||
if html = doc.css("p").first&.inner_html&.strip
|
||||
new_description = html unless html.starts_with?(Category.post_template[0..50])
|
||||
category.update_column(:description, new_description)
|
||||
@category_changed = category
|
||||
else
|
||||
@post.errors[:base] << I18n.t("category.errors.description_incomplete")
|
||||
end
|
||||
end
|
||||
|
||||
def advance_draft_sequence
|
||||
|
||||
Reference in New Issue
Block a user