fixes #2920: "Undo" function not working for Post Versions

This commit is contained in:
r888888888
2017-03-09 11:44:28 -08:00
parent 865a2ca165
commit 43f31529d7
3 changed files with 111 additions and 2 deletions

View File

@@ -20,6 +20,12 @@ module PostArchiveTestHelper
json.delete("created_at")
json["version"] = 1 + PostArchive.where(post_id: json["post_id"]).count
prev = PostArchive.where(post_id: json["post_id"]).order("id desc").first
if prev
json["added_tags"] = json["tags"].scan(/\S+/) - prev.tags.scan(/\S+/)
json["removed_tags"] = prev.tags.scan(/\S+/) - json["tags"].scan(/\S+/)
else
json["added_tags"] = json["tags"].scan(/\S+/)
end
if merge?(prev, json)
prev.update_columns(json)
else