Topic can have null user_id when user was nuked

This commit is contained in:
Neil Lalonde
2013-09-04 15:35:10 -04:00
parent 117fc8db58
commit d76486a48b
4 changed files with 37 additions and 5 deletions

View File

@ -25,6 +25,9 @@ class UserDestroyer
end
end
PostDestroyer.new(@staff, post).destroy
if post.topic and post.post_number == 1
Topic.unscoped.where(id: post.topic.id).update_all(user_id: nil)
end
end
raise PostsExistError if user.reload.post_count != 0
end