Merge pull request #3526 from BrokenEagle/fix-mod-actions

Fix mod actions
This commit is contained in:
Albert Yi
2018-01-30 11:40:54 -08:00
committed by GitHub
3 changed files with 8 additions and 3 deletions

View File

@@ -29,6 +29,7 @@ class ModAction < ApplicationRecord
post_ban: 44,
post_unban: 45,
post_permanent_delete: 46,
post_move_favorites: 47,
pool_delete: 62,
pool_undelete: 63,
artist_ban: 184,

View File

@@ -1330,7 +1330,7 @@ class Post < ApplicationRecord
Post.find(parent_id_was).update_has_children_flag if parent_id_was.present?
end
def give_favorites_to_parent
def give_favorites_to_parent(options = {})
return if parent.nil?
transaction do
@@ -1339,6 +1339,10 @@ class Post < ApplicationRecord
parent.add_favorite!(fav.user)
end
end
unless options[:without_mod_action]
ModAction.log("moved favorites from post ##{id} to post ##{parent.id}",:post_move_favorites)
end
end
def parent_exists?
@@ -1413,7 +1417,7 @@ class Post < ApplicationRecord
}, without_protection: true)
# XXX This must happen *after* the `is_deleted` flag is set to true (issue #3419).
give_favorites_to_parent if options[:move_favorites]
give_favorites_to_parent(options) if options[:move_favorites]
unless options[:without_mod_action]
ModAction.log("deleted post ##{id}, reason: #{reason}",:post_delete)

View File

@@ -47,7 +47,7 @@ class UserNameChangeRequest < ApplicationRecord
body = "Your name change request has been approved. Be sure to log in with your new user name."
Dmail.create_automated(:title => "Name change request approved", :body => body, :to_id => user_id)
UserFeedback.create(:user_id => user_id, :category => "neutral", :body => "Name changed from #{original_name} to #{desired_name}")
ModAction.log("Name changed from #{original_name} to #{desired_name}")
ModAction.log("Name changed from #{original_name} to #{desired_name}",:user_name_change)
end
def reject!(reason)