Compare commits

...
Author SHA1 Message Date
Shivam Mishra 2d49d499e4 test: remove case for 2024-03-25 20:40:34 +05:30
Shivam Mishra 29503af824 refactor: remove unnecessary function
* Devise library already does that for us
2024-03-25 20:39:05 +05:30
Shivam Kumar 75cc9356a4 Merge branch 'fix-Agent-Email' of https://github.com/shivamkb17/chatwoot into fix-Agent-Email 2024-03-19 23:09:13 +05:30
Shivam Kumar 0e47a14350 Fix agent double invite mail 2024-03-19 23:09:09 +05:30
Shivam Kumar 5c30cc2da3 Update agent_builder.rb 2024-03-19 23:06:58 +05:30
2 changed files with 0 additions and 22 deletions
-6
View File
@@ -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,11 +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
@user.send_confirmation_instructions if user_needs_confirmation?
end
# Checks if the user needs confirmation.
# @return [Boolean] true if the user is persisted and not confirmed, false otherwise.
def user_needs_confirmation?
-16
View File
@@ -67,21 +67,5 @@ RSpec.describe AgentBuilder, type: :model do
expect(user.encrypted_password).not_to be_empty
end
end
context 'with confirmation required' do
let(:unconfirmed_user) { create(:user, email: email) }
before do
unconfirmed_user.confirmed_at = nil
unconfirmed_user.save(validate: false)
allow(unconfirmed_user).to receive(:confirmed?).and_return(false)
end
it 'sends confirmation instructions' do
user = agent_builder.perform
expect(user).to receive(:send_confirmation_instructions)
agent_builder.send(:send_confirmation_if_required)
end
end
end
end