mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 04:54:37 +08:00
FEATURE: auto remove user status after predefined period (#17236)
This commit is contained in:

committed by
GitHub

parent
4acf2394e6
commit
c59f1729a6
@ -6,6 +6,10 @@ class UserStatus < ActiveRecord::Base
|
||||
validate :ends_at_greater_than_set_at,
|
||||
if: Proc.new { |t| t.will_save_change_to_set_at? || t.will_save_change_to_ends_at? }
|
||||
|
||||
def expired?
|
||||
ends_at && ends_at < Time.zone.now
|
||||
end
|
||||
|
||||
def ends_at_greater_than_set_at
|
||||
if ends_at && set_at > ends_at
|
||||
errors.add(:ends_at, I18n.t("user_status.errors.ends_at_should_be_greater_than_set_at"))
|
||||
|
Reference in New Issue
Block a user