Skip to content

Commit

Permalink
fix: Remove user validations on update
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentinchampenois committed Nov 23, 2023
1 parent 2a9f49d commit 498c16c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/jobs/decidim/cleaner/clean_inactive_users_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,19 @@ def send_warning(users)
users.find_each do |user|
next if user.warning_date.present?

user.update!(warning_date: Time.zone.now) if InactiveUsersMailer.warning_inactive(user).deliver_now
if InactiveUsersMailer.warning_inactive(user).deliver_now
user.warning_date = Time.zone.now
user.save(validate: false)
end
Rails.logger.info "Inactive warning sent to #{user.email}"
end
end

def delete_user_and_send_email(users)
users.find_each do |user|
if user.current_sign_in_at > user.warning_date
user.update!(warning_date: nil)
user.warning_date = nil
user.save(validate: false)
Rails.logger.info "User with id #{user.id} has logged in again, warning date reset"
next
end
Expand Down

0 comments on commit 498c16c

Please sign in to comment.