269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
|
# File 'lib/post_destroyer.rb', line 269
def user_recovered
return unless @post.user_deleted?
Post.transaction do
@post.update_column(:user_deleted, false)
@post.skip_unique_check = true
@post.topic.update_column(:closed, false) if @post.is_first_post?
end
last_revision = @post.revisions.last
if last_revision.present? && last_revision.modifications["raw"].present?
@post.revise(@user, { raw: last_revision.modifications["raw"][0] }, force_new_version: true)
end
end
|