change formatting for modactions on alias/implication update + add mod action for tag batch changes

This commit is contained in:
Albert Yi
2016-12-05 14:46:02 -08:00
parent 2605da1037
commit eddf2e59f0
4 changed files with 13 additions and 7 deletions

View File

@@ -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

View File

@@ -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