forked from e621ng/e621ng
[ModActions] Display ip ban subnet and reason
This commit is contained in:
parent
63db033dc2
commit
7c0fec2be9
@ -28,9 +28,18 @@ class ModActionDecorator < ApplicationDecorator
|
||||
|
||||
### IP Ban ###
|
||||
when "ip_ban_create"
|
||||
"Created ip ban"
|
||||
msg = "Created ip ban"
|
||||
if CurrentUser.is_admin?
|
||||
msg += " #{vals['ip_addr']}\nBan reason: #{vals['reason']}"
|
||||
end
|
||||
msg
|
||||
|
||||
when "ip_ban_delete"
|
||||
"Removed ip ban"
|
||||
msg = "Removed ip ban"
|
||||
if CurrentUser.is_admin?
|
||||
msg += " #{vals['ip_addr']}\nBan reason: #{vals['reason']}"
|
||||
end
|
||||
msg
|
||||
|
||||
### Ticket ###
|
||||
when "ticket_update"
|
||||
|
@ -4,10 +4,10 @@ class IpBan < ApplicationRecord
|
||||
validates :ip_addr, uniqueness: true
|
||||
validate :validate_ip_addr
|
||||
after_create do |rec|
|
||||
ModAction.log(:ip_ban_create, { ip_addr: rec.ip_addr })
|
||||
ModAction.log(:ip_ban_create, { ip_addr: rec.subnetted_ip, reason: rec.reason })
|
||||
end
|
||||
after_destroy do |rec|
|
||||
ModAction.log(:ip_ban_delete, { ip_addr: rec.ip_addr })
|
||||
ModAction.log(:ip_ban_delete, { ip_addr: rec.subnetted_ip, reason: rec.reason })
|
||||
end
|
||||
|
||||
def self.is_banned?(ip_addr)
|
||||
|
Loading…
Reference in New Issue
Block a user