change formatting for modactions on alias/implication update + add mod action for tag batch changes
This commit is contained in:
@@ -20,6 +20,10 @@ class BulkRevert
|
||||
@_preview ||= find_post_versions
|
||||
end
|
||||
|
||||
def query_gbq(user_id, added_tags, removed_tags, min_version_id, max_version_id)
|
||||
GoogleBigQuery::PostVersion.new.find(user_id, added_tags, removed_tags, min_version_id, max_version_id, BIG_QUERY_LIMIT)
|
||||
end
|
||||
|
||||
def find_post_versions
|
||||
q = PostVersion.where("true")
|
||||
|
||||
@@ -34,7 +38,7 @@ class BulkRevert
|
||||
if constraints[:added_tags] || constraints[:removed_tags]
|
||||
hash = CityHash.hash64("#{constraints[:added_tags]} #{constraints{removed_tags}} #{constraints[:min_version_id]} #{constraints[:max_version_id]}").to_s(36)
|
||||
sub_ids = Cache.get("br/fpv/#{hash}", 300) do
|
||||
GoogleBigQuery::PostVersion.new.find(constraints[:user_id], constraints[:added_tags], constraints[:removed_tags], constraints[:min_version_id], constraints[:max_version_id], BIG_QUERY_LIMIT)
|
||||
query_gbq(constraints[:user_id], constraints[:added_tags], constraints[:removed_tags], constraints[:min_version_id], constraints[:max_version_id])
|
||||
end
|
||||
|
||||
if sub_ids.size >= BIG_QUERY_LIMIT
|
||||
|
||||
@@ -12,6 +12,8 @@ module Moderator
|
||||
|
||||
CurrentUser.without_safe_mode do
|
||||
CurrentUser.scoped(updater, updater_ip_addr) do
|
||||
ModAction.create(:description => "processed mass update: #{antecedent} -> #{consequent}")
|
||||
|
||||
::Post.tag_match(antecedent).where("true /* Moderator::TagBatchChange#perform */").find_each do |post|
|
||||
post.reload
|
||||
tags = (post.tag_array - normalized_antecedent + normalized_consequent).join(" ")
|
||||
|
||||
@@ -326,10 +326,10 @@ class TagAlias < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def create_mod_action
|
||||
alias_desc = %Q("tag alias ##{id}":[#{Rails.application.routes.url_helpers.tag_alias_path(self)}] ([[#{antecedent_name}]] -> [[#{consequent_name}]]))
|
||||
alias_desc = %Q("tag alias ##{id}":[#{Rails.application.routes.url_helpers.tag_alias_path(self)}]: [[#{antecedent_name}]] -> [[#{consequent_name}]])
|
||||
|
||||
if id_changed?
|
||||
ModAction.create(:description => "created #{status} #{alias_desc}.")
|
||||
ModAction.create(:description => "created #{status} #{alias_desc}")
|
||||
else
|
||||
# format the changes hash more nicely.
|
||||
change_desc = changes.except(:updated_at).map do |attribute, values|
|
||||
@@ -341,7 +341,7 @@ class TagAlias < ActiveRecord::Base
|
||||
end
|
||||
end.join(", ")
|
||||
|
||||
ModAction.create(:description => "updated #{alias_desc}: #{change_desc}.")
|
||||
ModAction.create(:description => "updated #{alias_desc}\n#{change_desc}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -294,10 +294,10 @@ class TagImplication < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def create_mod_action
|
||||
implication = %Q("tag implication ##{id}":[#{Rails.application.routes.url_helpers.tag_implication_path(self)}] ([[#{antecedent_name}]] -> [[#{consequent_name}]]))
|
||||
implication = %Q("tag implication ##{id}":[#{Rails.application.routes.url_helpers.tag_implication_path(self)}]: [[#{antecedent_name}]] -> [[#{consequent_name}]])
|
||||
|
||||
if id_changed?
|
||||
ModAction.create(:description => "created #{status} #{implication}.")
|
||||
ModAction.create(:description => "created #{status} #{implication}")
|
||||
else
|
||||
# format the changes hash more nicely.
|
||||
change_desc = changes.except(:updated_at).map do |attribute, values|
|
||||
@@ -309,7 +309,7 @@ class TagImplication < ActiveRecord::Base
|
||||
end
|
||||
end.join(", ")
|
||||
|
||||
ModAction.create(:description => "updated #{implication}: #{change_desc}.")
|
||||
ModAction.create(:description => "updated #{implication}\n#{change_desc}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user