FIX: Should be able to recover a user deleted post if raw didn't change

This commit is contained in:
Robin Ward
2019-04-10 13:10:21 -04:00
parent fe9c271d44
commit abf4ca9774
2 changed files with 13 additions and 1 deletions

View File

@ -188,7 +188,9 @@ class PostDestroyer
# has internal transactions, if we nest then there are some very high risk deadlocks
last_revision = @post.revisions.last
@post.revise(@user, { raw: last_revision.modifications["raw"][0] }, force_new_version: true) if last_revision.present?
if last_revision.present? && last_revision.modifications['raw'].present?
@post.revise(@user, { raw: last_revision.modifications["raw"][0] }, force_new_version: true)
end
end
private