Added additional mod actions
This commit is contained in:
@@ -67,6 +67,7 @@ class ForumTopicsController < ApplicationController
|
||||
def destroy
|
||||
check_privilege(@forum_topic)
|
||||
@forum_topic.delete!
|
||||
@forum_topic.create_mod_action_for_delete
|
||||
flash[:notice] = "Topic deleted"
|
||||
respond_with(@forum_topic)
|
||||
end
|
||||
@@ -74,6 +75,7 @@ class ForumTopicsController < ApplicationController
|
||||
def undelete
|
||||
check_privilege(@forum_topic)
|
||||
@forum_topic.undelete!
|
||||
@forum_topic.create_mod_action_for_undelete
|
||||
flash[:notice] = "Topic undeleted"
|
||||
respond_with(@forum_topic)
|
||||
end
|
||||
|
||||
@@ -436,6 +436,7 @@ class Artist < ApplicationRecord
|
||||
end
|
||||
|
||||
update_column(:is_banned, false)
|
||||
ModAction.log("unbanned artist ##{id}",:artist_unban)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -458,6 +459,7 @@ class Artist < ApplicationRecord
|
||||
end
|
||||
|
||||
update_column(:is_banned, true)
|
||||
ModAction.log("banned artist ##{id}",:artist_ban)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -28,6 +28,9 @@ class ForumTopic < ApplicationRecord
|
||||
validates :title, :length => {:maximum => 255}
|
||||
accepts_nested_attributes_for :original_post
|
||||
after_update :update_orignal_post
|
||||
after_save(:if => lambda {|rec| rec.is_locked? && rec.is_locked_changed?}) do |rec|
|
||||
ModAction.log("locked forum topic ##{id} (title: #{title})",:forum_topic_lock)
|
||||
end
|
||||
|
||||
module CategoryMethods
|
||||
extend ActiveSupport::Concern
|
||||
@@ -154,6 +157,14 @@ class ForumTopic < ApplicationRecord
|
||||
user.level >= min_level
|
||||
end
|
||||
|
||||
def create_mod_action_for_delete
|
||||
ModAction.log("deleted forum topic ##{id} (title: #{title})",:forum_topic_delete)
|
||||
end
|
||||
|
||||
def create_mod_action_for_undelete
|
||||
ModAction.log("undeleted forum topic ##{id} (title: #{title})",:forum_topic_undelete)
|
||||
end
|
||||
|
||||
def initialize_is_deleted
|
||||
self.is_deleted = false if is_deleted.nil?
|
||||
end
|
||||
|
||||
@@ -31,8 +31,13 @@ class ModAction < ApplicationRecord
|
||||
post_permanent_delete: 46,
|
||||
pool_delete: 62,
|
||||
pool_undelete: 63,
|
||||
artist_ban: 184,
|
||||
artist_unban: 185,
|
||||
comment_update: 81,
|
||||
comment_delete: 82,
|
||||
forum_topic_delete: 202,
|
||||
forum_topic_undelete: 203,
|
||||
forum_topic_lock: 206,
|
||||
forum_post_update: 101,
|
||||
forum_post_delete: 102,
|
||||
tag_alias_create: 120,
|
||||
|
||||
Reference in New Issue
Block a user