From 29503af824883b2329ff92f342b250cceb4a6d2b Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Mon, 25 Mar 2024 20:39:05 +0530 Subject: [PATCH] refactor: remove unnecessary function * Devise library already does that for us --- app/builders/agent_builder.rb | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/app/builders/agent_builder.rb b/app/builders/agent_builder.rb index 0f71a00b6..54f478920 100644 --- a/app/builders/agent_builder.rb +++ b/app/builders/agent_builder.rb @@ -16,7 +16,6 @@ class AgentBuilder def perform ActiveRecord::Base.transaction do @user = find_or_create_user - send_confirmation_if_required create_account_user end @user @@ -34,15 +33,6 @@ class AgentBuilder User.create!(email: email, name: name, password: temp_password, password_confirmation: temp_password) end - # Sends confirmation instructions if the user is persisted and not confirmed. - def send_confirmation_if_required - return unless user_needs_confirmation? - if @user.confirmation_sent_at.nil? || @user.confirmation_sent_at < 1.hour.ago - @user.update(confirmation_sent_at: Time.current) - @user.send_confirmation_instructions - end - end - # Checks if the user needs confirmation. # @return [Boolean] true if the user is persisted and not confirmed, false otherwise. def user_needs_confirmation?