method for unbanning

This commit is contained in:
Kyle Drake 2019-12-18 20:58:59 -08:00
parent 82462b2461
commit 0afe4f6df3
2 changed files with 23 additions and 0 deletions

View file

@ -505,6 +505,14 @@ class Site < Sequel::Model
is_banned
end
def unban!
undelete!
self.is_banned = false
self.banned_at = nil
self.blackbox_whitelisted = true
save validate: false
end
def ban!
if username.nil? || username.empty?
raise 'username is missing'