X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/aaed886890216b0e45a92b49fec7aad49e281e74..67b0b5b885b8c488986260617775548fd5a5acc5:/app/models/user.rb diff --git a/app/models/user.rb b/app/models/user.rb index 7571dd9dc..1942a25cc 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -419,6 +419,18 @@ class User < ApplicationRecord end end + def deletion_allowed_at + unless Settings.user_account_deletion_delay.nil? + last_changeset = changesets.reorder(:closed_at => :desc).first + return last_changeset.closed_at.utc + Settings.user_account_deletion_delay.hours if last_changeset + end + creation_time.utc + end + + def deletion_allowed? + deletion_allowed_at <= Time.now.utc + end + private def encrypt_password