Merge branch 'chatwoot:develop' into feat/paste-image
This commit is contained in:
commit
edf0b98624
4 changed files with 27 additions and 3 deletions
|
@ -17,7 +17,8 @@ class Api::V1::Widget::ConversationsController < Api::V1::Widget::BaseController
|
|||
@contact = ContactIdentifyAction.new(
|
||||
contact: @contact,
|
||||
params: { email: contact_email, phone_number: contact_phone_number, name: contact_name },
|
||||
retain_original_contact_name: true
|
||||
retain_original_contact_name: true,
|
||||
discard_invalid_attrs: true
|
||||
).perform
|
||||
end
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ class User < ApplicationRecord
|
|||
class_name: :PortalMember,
|
||||
dependent: :destroy_async
|
||||
has_many :portals,
|
||||
through: :portals_members,
|
||||
through: :portal_members,
|
||||
class_name: :Portal,
|
||||
dependent: :nullify,
|
||||
source: :portal
|
||||
|
|
|
@ -346,7 +346,7 @@ Rails.application.routes.draw do
|
|||
resources :accounts, only: [:index, :new, :create, :show, :edit, :update] do
|
||||
post :seed, on: :member
|
||||
end
|
||||
resources :users, only: [:index, :new, :create, :show, :edit, :update]
|
||||
resources :users, only: [:index, :new, :create, :show, :edit, :update, :destroy]
|
||||
resources :access_tokens, only: [:index, :show]
|
||||
resources :installation_configs, only: [:index, :new, :create, :show, :edit, :update]
|
||||
resources :agent_bots, only: [:index, :new, :create, :show, :edit, :update]
|
||||
|
|
|
@ -102,6 +102,29 @@ RSpec.describe '/api/v1/widget/conversations/toggle_typing', type: :request do
|
|||
expect(json_response['custom_attributes']['order_id']).to eq '12345'
|
||||
expect(json_response['messages'][0]['content']).to eq 'This is a test message'
|
||||
end
|
||||
|
||||
it 'doesnt not add phone number if the invalid phone number is provided' do
|
||||
existing_contact = create(:contact, account: account)
|
||||
|
||||
post '/api/v1/widget/conversations',
|
||||
headers: { 'X-Auth-Token' => token },
|
||||
params: {
|
||||
website_token: web_widget.website_token,
|
||||
contact: {
|
||||
name: 'contact-name-1',
|
||||
email: existing_contact.email,
|
||||
phone_number: '13456'
|
||||
},
|
||||
message: {
|
||||
content: 'This is a test message'
|
||||
}
|
||||
},
|
||||
as: :json
|
||||
|
||||
expect(response).to have_http_status(:success)
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response['contact']['phone_number']).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST /api/v1/widget/conversations/toggle_typing' do
|
||||
|
|
Loading…
Reference in a new issue