Fix #3837: Remove expired bans.

This commit is contained in:
evazion
2018-08-24 16:49:34 -05:00
parent 05ad112831
commit 2cdd022c37
3 changed files with 20 additions and 0 deletions

View File

@@ -61,6 +61,12 @@ class Ban < ApplicationRecord
q
end
def self.prune!
expired.includes(:user).find_each do |ban|
ban.user.unban! if ban.user.ban_expired?
end
end
def initialize_banner_id
self.banner_id = CurrentUser.id if self.banner_id.blank?
end