Skip to content

Commit

Permalink
added callback force delete check after email update
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg Hasjanov authored and Oleg Hasjanov committed Jan 8, 2024
1 parent bd12a73 commit ee8ab80
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@
# Do not commit one. Instead, download the latest from https://github.com/internetee/style-guide.
.rubocop.yml
/lib/tasks/mock.rake

.DS_Store
/node_modules
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
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
WORKDIR /opt/webapps/app
COPY Gemfile Gemfile.lock ./
Expand Down
16 changes: 16 additions & 0 deletions app/models/concerns/email_verifable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ module EmailVerifable

included do
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

def email_verification_failed?
Expand Down

0 comments on commit ee8ab80

Please sign in to comment.