remove reference to currentuser when processing bulk reverts

This commit is contained in:
r888888888
2017-11-15 16:48:22 -08:00
parent 7dea7eef89
commit 2da40dfc2b
2 changed files with 7 additions and 4 deletions

View File

@@ -7,7 +7,7 @@ class BulkRevert
def process(constraints)
@constraints = constraints
ModAction.log("#{CurrentUser.name} processed bulk revert for #{constraints.inspect}")
ModAction.log("Processed bulk revert for #{constraints.inspect}")
find_post_versions.order("updated_at, id").each do |version|
version.undo!

View File

@@ -141,9 +141,12 @@ class Tag < ApplicationRecord
Post.with_timeout(30_000, nil, {:tags => name}) do
Post.raw_tag_match(name).where("true /* Tag#update_category_post_counts */").find_each do |post|
post.reload
post.set_tag_counts(false)
args = TagCategory.categories.map {|x| ["tag_count_#{x}",post.send("tag_count_#{x}")]}.to_h.update(:tag_count => post.tag_count)
Post.where(:id => post.id).update_all(args)
# sometimes a post gets expunged
if post
post.set_tag_counts(false)
args = TagCategory.categories.map {|x| ["tag_count_#{x}",post.send("tag_count_#{x}")]}.to_h.update(:tag_count => post.tag_count)
Post.where(:id => post.id).update_all(args)
end
end
end
end