Chore: Replaced dependent destroy with dependent destroy_async in all models (#3249)

This commit is contained in:
Akhil G Krishnan
2021-11-18 10:32:29 +05:30
committed by GitHub
parent 4eeaadbd5b
commit b81a9f2010
23 changed files with 90 additions and 90 deletions

View File

@@ -8,17 +8,17 @@ RSpec.describe Account do
it { is_expected.to have_many(:users).through(:account_users) }
it { is_expected.to have_many(:account_users) }
it { is_expected.to have_many(:inboxes).dependent(:destroy) }
it { is_expected.to have_many(:conversations).dependent(:destroy) }
it { is_expected.to have_many(:contacts).dependent(:destroy) }
it { is_expected.to have_many(:telegram_bots).dependent(:destroy) }
it { is_expected.to have_many(:canned_responses).dependent(:destroy) }
it { is_expected.to have_many(:facebook_pages).class_name('::Channel::FacebookPage').dependent(:destroy) }
it { is_expected.to have_many(:web_widgets).class_name('::Channel::WebWidget').dependent(:destroy) }
it { is_expected.to have_many(:webhooks).dependent(:destroy) }
it { is_expected.to have_many(:notification_settings).dependent(:destroy) }
it { is_expected.to have_many(:inboxes).dependent(:destroy_async) }
it { is_expected.to have_many(:conversations).dependent(:destroy_async) }
it { is_expected.to have_many(:contacts).dependent(:destroy_async) }
it { is_expected.to have_many(:telegram_bots).dependent(:destroy_async) }
it { is_expected.to have_many(:canned_responses).dependent(:destroy_async) }
it { is_expected.to have_many(:facebook_pages).class_name('::Channel::FacebookPage').dependent(:destroy_async) }
it { is_expected.to have_many(:web_widgets).class_name('::Channel::WebWidget').dependent(:destroy_async) }
it { is_expected.to have_many(:webhooks).dependent(:destroy_async) }
it { is_expected.to have_many(:notification_settings).dependent(:destroy_async) }
it { is_expected.to have_many(:events) }
it { is_expected.to have_many(:kbase_portals).dependent(:destroy) }
it { is_expected.to have_many(:kbase_categories).dependent(:destroy) }
it { is_expected.to have_many(:teams).dependent(:destroy) }
it { is_expected.to have_many(:kbase_portals).dependent(:destroy_async) }
it { is_expected.to have_many(:kbase_categories).dependent(:destroy_async) }
it { is_expected.to have_many(:teams).dependent(:destroy_async) }
end

View File

@@ -13,7 +13,7 @@ RSpec.describe Channel::FacebookPage do
it { is_expected.to validate_presence_of(:account_id) }
# it { is_expected.to validate_uniqueness_of(:page_id).scoped_to(:account_id) }
it { is_expected.to belong_to(:account) }
it { is_expected.to have_one(:inbox).dependent(:destroy) }
it { is_expected.to have_one(:inbox).dependent(:destroy_async) }
describe 'concerns' do
it_behaves_like 'reauthorizable'

View File

@@ -9,7 +9,7 @@ RSpec.describe Contact do
context 'associations' do
it { is_expected.to belong_to(:account) }
it { is_expected.to have_many(:conversations).dependent(:destroy) }
it { is_expected.to have_many(:conversations).dependent(:destroy_async) }
end
describe 'pubsub_token' do

View File

@@ -13,21 +13,21 @@ RSpec.describe Inbox do
it { is_expected.to belong_to(:channel) }
it { is_expected.to have_many(:contact_inboxes).dependent(:destroy) }
it { is_expected.to have_many(:contact_inboxes).dependent(:destroy_async) }
it { is_expected.to have_many(:contacts).through(:contact_inboxes) }
it { is_expected.to have_many(:inbox_members).dependent(:destroy) }
it { is_expected.to have_many(:inbox_members).dependent(:destroy_async) }
it { is_expected.to have_many(:members).through(:inbox_members).source(:user) }
it { is_expected.to have_many(:conversations).dependent(:destroy) }
it { is_expected.to have_many(:conversations).dependent(:destroy_async) }
it { is_expected.to have_many(:messages).through(:conversations) }
it { is_expected.to have_one(:agent_bot_inbox) }
it { is_expected.to have_many(:webhooks).dependent(:destroy) }
it { is_expected.to have_many(:webhooks).dependent(:destroy_async) }
it { is_expected.to have_many(:events) }

View File

@@ -16,8 +16,8 @@ RSpec.describe User do
it { is_expected.to have_many(:accounts).through(:account_users) }
it { is_expected.to have_many(:account_users) }
it { is_expected.to have_many(:assigned_conversations).class_name('Conversation').dependent(:nullify) }
it { is_expected.to have_many(:inbox_members).dependent(:destroy) }
it { is_expected.to have_many(:notification_settings).dependent(:destroy) }
it { is_expected.to have_many(:inbox_members).dependent(:destroy_async) }
it { is_expected.to have_many(:notification_settings).dependent(:destroy_async) }
it { is_expected.to have_many(:messages) }
it { is_expected.to have_many(:events) }
it { is_expected.to have_many(:teams) }