fix: Name missing when email is collected via email hook (#6530)

- The name is not updated when the email is updated via the email collect message. This PR fixes that.
This commit is contained in:
Pranav Raj S 2023-02-24 01:54:53 -08:00 committed by GitHub
parent 26e760a281
commit c998c84bc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -17,7 +17,7 @@ class Api::V1::Widget::MessagesController < Api::V1::Widget::BaseController
@message.update!(submitted_email: contact_email)
ContactIdentifyAction.new(
contact: @contact,
params: { email: contact_email }
params: { email: contact_email, name: contact_name }
).perform
else
@message.update!(message_update_params[:message])

View File

@ -138,6 +138,7 @@ RSpec.describe '/api/v1/widget/messages', type: :request do
message.reload
expect(message.submitted_email).to eq(email)
expect(message.conversation.contact.email).to eq(email)
expect(message.conversation.contact.name).to eq(email.split('@')[0])
end
end