add additional mod actions

This commit is contained in:
Albert Yi
2017-01-03 16:02:36 -08:00
parent 4d698bf98b
commit b9a1e115fb
7 changed files with 54 additions and 3 deletions

View File

@@ -6,6 +6,12 @@ class IpBan < ActiveRecord::Base
validates_format_of :ip_addr, :with => IP_ADDR_REGEX
validates_uniqueness_of :ip_addr, :if => lambda {|rec| rec.ip_addr =~ IP_ADDR_REGEX}
attr_accessible :ip_addr, :reason
after_create do
ModAction.log("#{CurrentUser.name} created ip ban for #{rec.ip_addr}")
end
after_destroy do
ModAction.log("#{CurrentUser.name} deleted ip ban for ##{rec.ip_addr}")
end
def self.is_banned?(ip_addr)
exists?(["ip_addr = ?", ip_addr])
@@ -31,7 +37,7 @@ class IpBan < ActiveRecord::Base
return {
"comments" => comments,
"notes" => notes,
"pools" => pools,
# "pools" => pools,
"wiki_pages" => wiki_pages
}
end