added callback force delete check after email update

This commit is contained in:
Oleg Hasjanov 2024-01-08 15:39:48 +02:00 committed by Oleg Hasjanov
parent 682e166798
commit 1b8640966c
3 changed files with 23 additions and 2 deletions

1
.gitignore vendored
View file

@ -16,6 +16,5 @@
# Do not commit one. Instead, download the latest from https://github.com/internetee/style-guide. # Do not commit one. Instead, download the latest from https://github.com/internetee/style-guide.
.rubocop.yml .rubocop.yml
/lib/tasks/mock.rake /lib/tasks/mock.rake
.DS_Store .DS_Store
/node_modules /node_modules

View file

@ -1,5 +1,11 @@
FROM internetee/ruby:3.0-buster FROM internetee/ruby:3.0-buster
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4EB27DB2A3B88B8B
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
postgresql-client \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN mkdir -p /opt/webapps/app/tmp/pids RUN mkdir -p /opt/webapps/app/tmp/pids
WORKDIR /opt/webapps/app WORKDIR /opt/webapps/app
COPY Gemfile Gemfile.lock ./ COPY Gemfile Gemfile.lock ./

View file

@ -3,6 +3,22 @@ module EmailVerifable
included do included do
scope :recently_not_validated, -> { where.not(id: ValidationEvent.validated_ids_by(name)) } scope :recently_not_validated, -> { where.not(id: ValidationEvent.validated_ids_by(name)) }
after_save :verify_email, if: :email_changed?
end
def remove_force_delete
domains.each do |domain|
contact_emails_valid?(domain) ? domain.cancel_force_delete : domain.schedule_force_delete
end
end
def contact_emails_valid?(domain)
domain.contacts.each do |c|
return false unless c.need_to_lift_force_delete?
end
domain.registrant.need_to_lift_force_delete?
end end
def email_verification_failed? def email_verification_failed?