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