FIX: do not revise post if post revision is not present

This commit is contained in:
Arpit Jalan 2018-09-21 14:04:45 +05:30
parent b44bcdefd9
commit 2e02a28ab4

View File

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