don't fail serializing if title is missing

This commit is contained in:
Sam 2015-02-27 13:22:52 +11:00
parent 71d6266f98
commit 6a20d12772

View file

@ -112,8 +112,10 @@ class PostRevisionSerializer < ApplicationSerializer
end
def title_changes
prev = "<div>#{CGI::escapeHTML(previous["title"])}</div>"
cur = "<div>#{CGI::escapeHTML(current["title"])}</div>"
prev = "<div>#{previous["title"] && CGI::escapeHTML(previous["title"])}</div>"
cur = "<div>#{current["title"] && CGI::escapeHTML(current["title"])}</div>"
return if prev == cur
diff = DiscourseDiff.new(prev, cur)