From 5c30cc2da3b3397f1019e40f56576643ed032280 Mon Sep 17 00:00:00 2001 From: Shivam Kumar Date: Tue, 19 Mar 2024 23:06:58 +0530 Subject: [PATCH] Update agent_builder.rb --- app/builders/agent_builder.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/builders/agent_builder.rb b/app/builders/agent_builder.rb index 07b0e7345..0f71a00b6 100644 --- a/app/builders/agent_builder.rb +++ b/app/builders/agent_builder.rb @@ -36,7 +36,11 @@ class AgentBuilder # Sends confirmation instructions if the user is persisted and not confirmed. def send_confirmation_if_required - @user.send_confirmation_instructions if user_needs_confirmation? + 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.