Be consistent checking changes in draft versions
There's no reason to only convert Markdown to HTML in translations when their body changes but to always convert it when the "main" body field changes. Whether we should always use the condition or never use it is something we can debate about, though.
This commit is contained in:
@@ -26,8 +26,10 @@ class Legislation::DraftVersion < ActiveRecord::Base
|
||||
renderer = Redcarpet::Render::HTML.new(with_toc_data: true)
|
||||
toc_renderer = Redcarpet::Render::HTML_TOC.new(with_toc_data: true)
|
||||
|
||||
self.body_html = Redcarpet::Markdown.new(renderer).render(body)
|
||||
self.toc_html = Redcarpet::Markdown.new(toc_renderer).render(body)
|
||||
if body_changed?
|
||||
self.body_html = Redcarpet::Markdown.new(renderer).render(body)
|
||||
self.toc_html = Redcarpet::Markdown.new(toc_renderer).render(body)
|
||||
end
|
||||
|
||||
translations.each do |translation|
|
||||
if translation.body_changed?
|
||||
|
||||
Reference in New Issue
Block a user