implement postarchive

This commit is contained in:
Albert Yi
2017-01-13 17:21:05 -08:00
committed by r888888888
parent 6c9d5e4f9a
commit 5404c1d231
17 changed files with 378 additions and 98 deletions

View File

@@ -15,13 +15,13 @@ class UserRevert
end
def validate!
if PostVersion.where(updater_id: user_id).count > THRESHOLD
if PostArchive.where(updater_id: user_id).count > THRESHOLD
raise TooManyChangesError.new("This user has too many changes to be reverted")
end
end
def revert_post_changes
PostVersion.where(updater_id: user_id).find_each do |x|
PostArchive.where(updater_id: user_id).find_each do |x|
x.undo!
end
end