From cf487c76a0c3649a100b88419dd3fd9d49942415 Mon Sep 17 00:00:00 2001
From: Tejaswini Chile
Date: Wed, 15 Mar 2023 21:49:49 +0530
Subject: [PATCH 001/100] fix: delete user record if belongs to no account
(#6664)
---
.../api/v1/accounts/agents_controller.rb | 5 ++++
.../api/v1/accounts/agents_controller_spec.rb | 28 ++++++++++++++++---
2 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/app/controllers/api/v1/accounts/agents_controller.rb b/app/controllers/api/v1/accounts/agents_controller.rb
index eb409b9ff..9a089f242 100644
--- a/app/controllers/api/v1/accounts/agents_controller.rb
+++ b/app/controllers/api/v1/accounts/agents_controller.rb
@@ -19,6 +19,7 @@ class Api::V1::Accounts::AgentsController < Api::V1::Accounts::BaseController
def destroy
@agent.current_account_user.destroy!
+ delete_user_record(@agent)
head :ok
end
@@ -74,4 +75,8 @@ class Api::V1::Accounts::AgentsController < Api::V1::Accounts::BaseController
def validate_limit
render_payment_required('Account limit exceeded. Please purchase more licenses') if agents.count >= Current.account.usage_limits[:agents]
end
+
+ def delete_user_record(agent)
+ DeleteObjectJob.perform_later(agent) if agent.reload.account_users.blank?
+ end
end
diff --git a/spec/controllers/api/v1/accounts/agents_controller_spec.rb b/spec/controllers/api/v1/accounts/agents_controller_spec.rb
index ffbae10c9..b0ce320ff 100644
--- a/spec/controllers/api/v1/accounts/agents_controller_spec.rb
+++ b/spec/controllers/api/v1/accounts/agents_controller_spec.rb
@@ -1,6 +1,8 @@
require 'rails_helper'
RSpec.describe 'Agents API', type: :request do
+ include ActiveJob::TestHelper
+
let(:account) { create(:account) }
let(:admin) { create(:user, custom_attributes: { test: 'test' }, account: account, role: :administrator) }
let(:agent) { create(:user, account: account, role: :agent) }
@@ -60,13 +62,31 @@ RSpec.describe 'Agents API', type: :request do
expect(response).to have_http_status(:unauthorized)
end
- it 'deletes an agent' do
- delete "/api/v1/accounts/#{account.id}/agents/#{other_agent.id}",
- headers: admin.create_new_auth_token,
- as: :json
+ it 'deletes the agent and user object if associated with only one account' do
+ perform_enqueued_jobs(only: DeleteObjectJob) do
+ delete "/api/v1/accounts/#{account.id}/agents/#{other_agent.id}",
+ headers: admin.create_new_auth_token,
+ as: :json
+ end
+
+ expect(response).to have_http_status(:success)
+ expect(account.reload.users.size).to eq(1)
+ expect(User.count).to eq(account.reload.users.size)
+ end
+
+ it 'deletes only the agent object when user is associated with multiple accounts' do
+ other_account = create(:account)
+ create(:account_user, account_id: other_account.id, user_id: other_agent.id)
+
+ perform_enqueued_jobs(only: DeleteObjectJob) do
+ delete "/api/v1/accounts/#{account.id}/agents/#{other_agent.id}",
+ headers: admin.create_new_auth_token,
+ as: :json
+ end
expect(response).to have_http_status(:success)
expect(account.users.size).to eq(1)
+ expect(User.count).to eq(account.reload.users.size + 1)
end
end
end
From 5c5764ca85688be2fa5ea0c23a54bf80d7409eb4 Mon Sep 17 00:00:00 2001
From: Muhsin Keloth
Date: Thu, 16 Mar 2023 20:32:55 +0530
Subject: [PATCH 002/100] chore: Enable icelandic language(#6682)
ref: #6681
---
app/javascript/survey/i18n/index.js | 2 ++
app/javascript/widget/i18n/index.js | 2 ++
2 files changed, 4 insertions(+)
diff --git a/app/javascript/survey/i18n/index.js b/app/javascript/survey/i18n/index.js
index f707c4478..391d67848 100644
--- a/app/javascript/survey/i18n/index.js
+++ b/app/javascript/survey/i18n/index.js
@@ -12,6 +12,7 @@ import fr from './locale/fr.json';
import hi from './locale/hi.json';
import hu from './locale/hu.json';
import id from './locale/id.json';
+import is from './locale/is.json';
import it from './locale/it.json';
import ja from './locale/ja.json';
import ko from './locale/ko.json';
@@ -49,6 +50,7 @@ export default {
hi,
hu,
id,
+ is,
it,
ja,
ko,
diff --git a/app/javascript/widget/i18n/index.js b/app/javascript/widget/i18n/index.js
index 671e6e049..544397ddd 100644
--- a/app/javascript/widget/i18n/index.js
+++ b/app/javascript/widget/i18n/index.js
@@ -12,6 +12,7 @@ import fr from './locale/fr.json';
import hi from './locale/hi.json';
import hu from './locale/hu.json';
import id from './locale/id.json';
+import is from './locale/is.json';
import it from './locale/it.json';
import ja from './locale/ja.json';
import ko from './locale/ko.json';
@@ -49,6 +50,7 @@ export default {
hi,
hu,
id,
+ is,
it,
ja,
ko,
From e76b63f91d024652ba3e7d4107c3294b5108d434 Mon Sep 17 00:00:00 2001
From: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com>
Date: Fri, 17 Mar 2023 02:12:52 +0530
Subject: [PATCH 003/100] chore: Upgrade prosemirror package to fix link
rendering issue (#6685)
---
yarn.lock | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/yarn.lock b/yarn.lock
index 16daef1ec..ef0e418db 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1393,7 +1393,7 @@
"@chatwoot/prosemirror-schema@https://github.com/chatwoot/prosemirror-schema.git":
version "1.0.0"
- resolved "https://github.com/chatwoot/prosemirror-schema.git#ebbf09d6ebd9138cdf2bb47257bb02ebbf01af53"
+ resolved "https://github.com/chatwoot/prosemirror-schema.git#3306cdb220797090ce41ea607174e940330177e1"
dependencies:
prosemirror-commands "^1.1.4"
prosemirror-dropcursor "^1.3.2"
From d2aa5f4c69a93d573ae9bff43f995eb1d16ea3e3 Mon Sep 17 00:00:00 2001
From: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com>
Date: Mon, 20 Mar 2023 11:04:56 +0530
Subject: [PATCH 004/100] fix: Reverts popover styling for search page (#6688)
---
.../modules/search/components/SearchHeader.vue | 5 +++--
.../modules/search/components/SearchTabs.vue | 2 +-
.../modules/search/components/SearchView.vue | 13 ++++++-------
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/app/javascript/dashboard/modules/search/components/SearchHeader.vue b/app/javascript/dashboard/modules/search/components/SearchHeader.vue
index aa85eddab..107cfbc2a 100644
--- a/app/javascript/dashboard/modules/search/components/SearchHeader.vue
+++ b/app/javascript/dashboard/modules/search/components/SearchHeader.vue
@@ -76,7 +76,8 @@ export default {
display: flex;
align-items: center;
padding: var(--space-small) var(--space-normal);
- border-bottom: 1px solid var(--s-100);
+ border: 1px solid var(--s-100);
+ border-radius: var(--border-radius-small);
transition: border-bottom 0.2s ease-in-out;
input[type='search'] {
@@ -86,7 +87,7 @@ export default {
}
&.is-focused {
- border-bottom: 1px solid var(--w-100);
+ border-color: var(--w-100);
.icon {
color: var(--w-400);
diff --git a/app/javascript/dashboard/modules/search/components/SearchTabs.vue b/app/javascript/dashboard/modules/search/components/SearchTabs.vue
index 7d0d53063..011dff845 100644
--- a/app/javascript/dashboard/modules/search/components/SearchTabs.vue
+++ b/app/javascript/dashboard/modules/search/components/SearchTabs.vue
@@ -35,6 +35,6 @@ export default {
diff --git a/app/javascript/dashboard/modules/search/components/SearchView.vue b/app/javascript/dashboard/modules/search/components/SearchView.vue
index c079b46ae..43412b40f 100644
--- a/app/javascript/dashboard/modules/search/components/SearchView.vue
+++ b/app/javascript/dashboard/modules/search/components/SearchView.vue
@@ -47,7 +47,7 @@
-
+
@@ -202,23 +202,21 @@ export default {
}
.search-root {
margin: 0 auto;
- max-width: 64rem;
+ max-width: 72rem;
min-height: 48rem;
width: 100%;
height: fit-content;
- box-shadow: var(--shadow);
+ padding: var(--space-normal);
display: flex;
position: relative;
flex-direction: column;
background: white;
- border-radius: var(--border-radius-large);
+ overflow-y: auto;
margin-top: var(--space-large);
- border-top: 1px solid var(--s-25);
+
.search-results {
flex-grow: 1;
height: 100%;
- max-height: 80vh;
- overflow-y: auto;
padding: 0 var(--space-small);
}
}
@@ -230,6 +228,7 @@ export default {
justify-content: center;
padding: var(--space-medium) var(--space-normal);
border-radius: var(--border-radius-medium);
+ margin-top: var(--space-large);
.icon {
color: var(--s-500);
}
From 0c9f129c74ee65aa88ea0617e46b0609a9acefc9 Mon Sep 17 00:00:00 2001
From: Tarang
Date: Mon, 20 Mar 2023 17:57:43 +1100
Subject: [PATCH 005/100] Fix issues with Microsoft Provider (#6702)
---
.../api/v1/accounts/microsoft/authorizations_controller.rb | 3 ++-
app/controllers/microsoft/callbacks_controller.rb | 4 ++--
.../v1/accounts/microsoft/authorization_controller_spec.rb | 2 +-
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/app/controllers/api/v1/accounts/microsoft/authorizations_controller.rb b/app/controllers/api/v1/accounts/microsoft/authorizations_controller.rb
index 49a4bdcb0..bee47b213 100644
--- a/app/controllers/api/v1/accounts/microsoft/authorizations_controller.rb
+++ b/app/controllers/api/v1/accounts/microsoft/authorizations_controller.rb
@@ -7,11 +7,12 @@ class Api::V1::Accounts::Microsoft::AuthorizationsController < Api::V1::Accounts
redirect_url = microsoft_client.auth_code.authorize_url(
{
redirect_uri: "#{base_url}/microsoft/callback",
- scope: 'offline_access https://outlook.office.com/IMAP.AccessAsUser.All https://outlook.office.com/SMTP.Send openid',
+ scope: 'offline_access https://outlook.office.com/IMAP.AccessAsUser.All https://outlook.office.com/SMTP.Send openid profile',
prompt: 'consent'
}
)
if redirect_url
+ email = email.downcase
::Redis::Alfred.setex(email, Current.account.id, 5.minutes)
render json: { success: true, url: redirect_url }
else
diff --git a/app/controllers/microsoft/callbacks_controller.rb b/app/controllers/microsoft/callbacks_controller.rb
index c3ecb8c09..215103bd4 100644
--- a/app/controllers/microsoft/callbacks_controller.rb
+++ b/app/controllers/microsoft/callbacks_controller.rb
@@ -8,7 +8,7 @@ class Microsoft::CallbacksController < ApplicationController
)
inbox = find_or_create_inbox
- ::Redis::Alfred.delete(users_data['email'])
+ ::Redis::Alfred.delete(users_data['email'].downcase)
redirect_to app_microsoft_inbox_agents_url(account_id: account.id, inbox_id: inbox.id)
rescue StandardError => e
ChatwootExceptionTracker.new(e).capture_exception
@@ -31,7 +31,7 @@ class Microsoft::CallbacksController < ApplicationController
end
def account_id
- ::Redis::Alfred.get(users_data['email'])
+ ::Redis::Alfred.get(users_data['email'].downcase)
end
def account
diff --git a/spec/controllers/api/v1/accounts/microsoft/authorization_controller_spec.rb b/spec/controllers/api/v1/accounts/microsoft/authorization_controller_spec.rb
index b65ea160d..60948bce1 100644
--- a/spec/controllers/api/v1/accounts/microsoft/authorization_controller_spec.rb
+++ b/spec/controllers/api/v1/accounts/microsoft/authorization_controller_spec.rb
@@ -36,7 +36,7 @@ RSpec.describe 'Microsoft Authorization API', type: :request do
response_url = microsoft_service.microsoft_client.auth_code.authorize_url(
{
redirect_uri: "#{ENV.fetch('FRONTEND_URL', 'http://localhost:3000')}/microsoft/callback",
- scope: 'offline_access https://outlook.office.com/IMAP.AccessAsUser.All https://outlook.office.com/SMTP.Send openid',
+ scope: 'offline_access https://outlook.office.com/IMAP.AccessAsUser.All https://outlook.office.com/SMTP.Send openid profile',
prompt: 'consent'
}
)
From 4f936aada54cfb3a807810a4419504054ae9c4e3 Mon Sep 17 00:00:00 2001
From: Tejaswini Chile
Date: Mon, 20 Mar 2023 13:46:07 +0530
Subject: [PATCH 006/100] [CW-1342]: Inbox deletion in background job (#6708)
---
.../api/v1/accounts/inboxes_controller.rb | 4 ++--
config/locales/en.yml | 1 +
.../v1/accounts/inboxes_controller_spec.rb | 22 +++++++++++++------
3 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/app/controllers/api/v1/accounts/inboxes_controller.rb b/app/controllers/api/v1/accounts/inboxes_controller.rb
index 24f797025..20402b5d1 100644
--- a/app/controllers/api/v1/accounts/inboxes_controller.rb
+++ b/app/controllers/api/v1/accounts/inboxes_controller.rb
@@ -82,8 +82,8 @@ class Api::V1::Accounts::InboxesController < Api::V1::Accounts::BaseController
end
def destroy
- @inbox.destroy!
- head :ok
+ ::DeleteObjectJob.perform_later(@inbox) if @inbox.present?
+ render status: :ok, json: { message: I18n.t('messages.inbox_deletetion_response') }
end
private
diff --git a/config/locales/en.yml b/config/locales/en.yml
index d395cb54f..375e70127 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -34,6 +34,7 @@ en:
messages:
reset_password_success: Woot! Request for password reset is successful. Check your mail for instructions.
reset_password_failure: Uh ho! We could not find any user with the specified email.
+ inbox_deletetion_response: Your inbox deletion request will be processed in some time.
errors:
validations:
diff --git a/spec/controllers/api/v1/accounts/inboxes_controller_spec.rb b/spec/controllers/api/v1/accounts/inboxes_controller_spec.rb
index 577ed0365..90fbf68c6 100644
--- a/spec/controllers/api/v1/accounts/inboxes_controller_spec.rb
+++ b/spec/controllers/api/v1/accounts/inboxes_controller_spec.rb
@@ -1,6 +1,8 @@
require 'rails_helper'
RSpec.describe 'Inboxes API', type: :request do
+ include ActiveJob::TestHelper
+
let(:account) { create(:account) }
let(:agent) { create(:user, account: account, role: :agent) }
let(:admin) { create(:user, account: account, role: :administrator) }
@@ -250,9 +252,11 @@ RSpec.describe 'Inboxes API', type: :request do
end
it 'delete inbox avatar for administrator user' do
- delete "/api/v1/accounts/#{account.id}/inboxes/#{inbox.id}/avatar",
- headers: admin.create_new_auth_token,
- as: :json
+ perform_enqueued_jobs(only: DeleteObjectJob) do
+ delete "/api/v1/accounts/#{account.id}/inboxes/#{inbox.id}/avatar",
+ headers: admin.create_new_auth_token,
+ as: :json
+ end
expect { inbox.avatar.attachment.reload }.to raise_error(ActiveRecord::RecordNotFound)
expect(response).to have_http_status(:success)
@@ -283,12 +287,16 @@ RSpec.describe 'Inboxes API', type: :request do
let(:admin) { create(:user, account: account, role: :administrator) }
it 'deletes inbox' do
- delete "/api/v1/accounts/#{account.id}/inboxes/#{inbox.id}",
- headers: admin.create_new_auth_token,
- as: :json
+ perform_enqueued_jobs(only: DeleteObjectJob) do
+ delete "/api/v1/accounts/#{account.id}/inboxes/#{inbox.id}",
+ headers: admin.create_new_auth_token,
+ as: :json
+ end
+
+ json_response = JSON.parse(response.body)
expect(response).to have_http_status(:success)
- expect { inbox.reload }.to raise_exception(ActiveRecord::RecordNotFound)
+ expect(json_response['message']).to eq('Your inbox deletion request will be processed in some time.')
end
it 'is unable to delete inbox of another account' do
From e5134c9ef5624c3daf20212ee7343303edfaaccc Mon Sep 17 00:00:00 2001
From: Shivam Mishra
Date: Mon, 20 Mar 2023 15:46:29 +0530
Subject: [PATCH 007/100] [CW-53] feat: allow downloading heatmap report
(#6683)
* feat: add control header slot
* feat: add download API call
* feat: add conversation traffic template
* feat: allow downloading heatmap content
* feat: wire up download
* fix: grid layout for mobile
* chore: revert formatting
* revert: en.yml file
* feat: add conversation traffic text
* feat: disable rule for map block
* test: conversation traffic
* fix: timezone offset
* feat: download report in UTC
* feat: add UTC warning
* chore: revert formatting
* feat: add traffic text
* chore: fix whitespace change
---
.../api/v2/accounts/reports_controller.rb | 5 +
app/helpers/api/v2/accounts/reports_helper.rb | 21 ++++
app/javascript/dashboard/api/reports.js | 6 ++
.../settings/reports/LiveReports.vue | 20 ++++
.../components/overview/MetricCard.vue | 96 +++++++++++++------
.../dashboard/store/modules/reports.js | 22 ++++-
.../accounts/reports/conversation_traffic.erb | 12 +++
config/locales/en.yml | 4 +
config/routes.rb | 1 +
.../api/v2/accounts/report_controller_spec.rb | 35 +++++++
10 files changed, 192 insertions(+), 30 deletions(-)
create mode 100644 app/views/api/v2/accounts/reports/conversation_traffic.erb
diff --git a/app/controllers/api/v2/accounts/reports_controller.rb b/app/controllers/api/v2/accounts/reports_controller.rb
index dedeb17bf..a9fc5d4b4 100644
--- a/app/controllers/api/v2/accounts/reports_controller.rb
+++ b/app/controllers/api/v2/accounts/reports_controller.rb
@@ -32,6 +32,11 @@ class Api::V2::Accounts::ReportsController < Api::V1::Accounts::BaseController
generate_csv('teams_report', 'api/v2/accounts/reports/teams')
end
+ def conversation_traffic
+ @report_data = generate_conversations_heatmap_report
+ generate_csv('conversation_traffic_reports', 'api/v2/accounts/reports/conversation_traffic')
+ end
+
def conversations
return head :unprocessable_entity if params[:type].blank?
diff --git a/app/helpers/api/v2/accounts/reports_helper.rb b/app/helpers/api/v2/accounts/reports_helper.rb
index 0604eba2f..b15683afd 100644
--- a/app/helpers/api/v2/accounts/reports_helper.rb
+++ b/app/helpers/api/v2/accounts/reports_helper.rb
@@ -27,6 +27,27 @@ module Api::V2::Accounts::ReportsHelper
end
end
+ def generate_conversations_heatmap_report
+ report_params = {
+ type: :account,
+ group_by: 'hour',
+ since: params[:since],
+ until: params[:until],
+ metric: 'conversations_count',
+ business_hours: false
+ }
+ data = V2::ReportBuilder.new(Current.account, report_params).build
+
+ # data format is { timestamp: 1231242342, value: 3}
+ # we need to convert it to { date: "2020-01-01", hour: 12, value: 3}
+ #
+ # the generated report is **always** in UTC timezone
+ data.map do |d|
+ date = Time.zone.at(d[:timestamp]).to_s
+ [date, d[:value]]
+ end
+ end
+
def generate_report(report_params)
V2::ReportBuilder.new(
Current.account,
diff --git a/app/javascript/dashboard/api/reports.js b/app/javascript/dashboard/api/reports.js
index 29fefeec8..dbd795f3c 100644
--- a/app/javascript/dashboard/api/reports.js
+++ b/app/javascript/dashboard/api/reports.js
@@ -59,6 +59,12 @@ class ReportsAPI extends ApiClient {
});
}
+ getConversationTrafficCSV({ from: since, to: until }) {
+ return axios.get(`${this.url}/conversation_traffic`, {
+ params: { since, until },
+ });
+ }
+
getLabelReports({ from: since, to: until, businessHours }) {
return axios.get(`${this.url}/labels`, {
params: { since, until, business_hours: businessHours },
diff --git a/app/javascript/dashboard/routes/dashboard/settings/reports/LiveReports.vue b/app/javascript/dashboard/routes/dashboard/settings/reports/LiveReports.vue
index 5de08717f..7acfc6251 100644
--- a/app/javascript/dashboard/routes/dashboard/settings/reports/LiveReports.vue
+++ b/app/javascript/dashboard/routes/dashboard/settings/reports/LiveReports.vue
@@ -40,6 +40,17 @@
+
+
+ Download Report
+
+
@@ -42,37 +51,66 @@ export default {
diff --git a/app/javascript/dashboard/routes/dashboard/settings/labels/EditLabel.vue b/app/javascript/dashboard/routes/dashboard/settings/labels/EditLabel.vue
index fbb15ac8a..f342af3e0 100644
--- a/app/javascript/dashboard/routes/dashboard/settings/labels/EditLabel.vue
+++ b/app/javascript/dashboard/routes/dashboard/settings/labels/EditLabel.vue
@@ -5,7 +5,7 @@
{
@@ -115,3 +115,13 @@ export default {
},
};
+
From 9c040af02880d55a0dcfadcf6f8ee6f347c2a022 Mon Sep 17 00:00:00 2001
From: Tejaswini Chile
Date: Tue, 21 Mar 2023 10:51:12 +0530
Subject: [PATCH 009/100] [CW-1348] fix: Update email regex validation for
contact_inbox (#6705)
---
app/models/contact_inbox.rb | 5 -----
.../contacts/contact_inboxes_controller_spec.rb | 16 +++++++++++++++-
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/app/models/contact_inbox.rb b/app/models/contact_inbox.rb
index 24f3b727a..5e592af1a 100644
--- a/app/models/contact_inbox.rb
+++ b/app/models/contact_inbox.rb
@@ -59,10 +59,6 @@ class ContactInbox < ApplicationRecord
end
end
- def validate_email_source_id
- errors.add(:source_id, "invalid source id for Email inbox. valid Regex #{Devise.email_regexp}") unless Devise.email_regexp.match?(source_id)
- end
-
def validate_whatsapp_source_id
return if WHATSAPP_CHANNEL_REGEX.match?(source_id)
@@ -71,7 +67,6 @@ class ContactInbox < ApplicationRecord
def valid_source_id_format?
validate_twilio_source_id if inbox.channel_type == 'Channel::TwilioSms'
- validate_email_source_id if inbox.channel_type == 'Channel::Email'
validate_whatsapp_source_id if inbox.channel_type == 'Channel::Whatsapp'
end
end
diff --git a/spec/controllers/api/v1/accounts/contacts/contact_inboxes_controller_spec.rb b/spec/controllers/api/v1/accounts/contacts/contact_inboxes_controller_spec.rb
index 1414c00e7..2bd393a5a 100644
--- a/spec/controllers/api/v1/accounts/contacts/contact_inboxes_controller_spec.rb
+++ b/spec/controllers/api/v1/accounts/contacts/contact_inboxes_controller_spec.rb
@@ -2,8 +2,9 @@ require 'rails_helper'
RSpec.describe '/api/v1/accounts/{account.id}/contacts/:id/contact_inboxes', type: :request do
let(:account) { create(:account) }
- let(:contact) { create(:contact, account: account) }
+ let(:contact) { create(:contact, account: account, email: 'f.o.o.b.a.r@gmail.com') }
let(:channel_twilio_sms) { create(:channel_twilio_sms, account: account) }
+ let(:channel_email) { create(:channel_email, account: account) }
let(:channel_api) { create(:channel_api, account: account) }
let(:agent) { create(:user, account: account) }
@@ -29,6 +30,19 @@ RSpec.describe '/api/v1/accounts/{account.id}/contacts/:id/contact_inboxes', typ
expect(contact.reload.contact_inboxes.map(&:inbox_id)).to include(channel_api.inbox.id)
end
+ it 'creates a valid email contact inbox' do
+ create(:inbox_member, inbox: channel_email.inbox, user: agent)
+ expect do
+ post "/api/v1/accounts/#{account.id}/contacts/#{contact.id}/contact_inboxes",
+ params: { inbox_id: channel_email.inbox.id },
+ headers: agent.create_new_auth_token,
+ as: :json
+ end.to change(ContactInbox, :count).by(1)
+
+ expect(response).to have_http_status(:success)
+ expect(contact.reload.contact_inboxes.map(&:inbox_id)).to include(channel_email.inbox.id)
+ end
+
it 'throws error for invalid source id' do
create(:inbox_member, inbox: channel_twilio_sms.inbox, user: agent)
expect do
From f3aba84063b4f2473dfb165734887bf08d142cb9 Mon Sep 17 00:00:00 2001
From: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com>
Date: Tue, 21 Mar 2023 12:10:08 +0530
Subject: [PATCH 010/100] fix: Fixes scroll behavior for search page (#6717)
---
.../modules/search/components/SearchView.vue | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/app/javascript/dashboard/modules/search/components/SearchView.vue b/app/javascript/dashboard/modules/search/components/SearchView.vue
index 43412b40f..819f4acec 100644
--- a/app/javascript/dashboard/modules/search/components/SearchView.vue
+++ b/app/javascript/dashboard/modules/search/components/SearchView.vue
@@ -1,5 +1,5 @@
-