Refactor: Simplifica o carregamento de módulos enterprise, remove a associação inbox_automations e adiciona tratamento de erro na verificação de migrações de banco de dados.
This commit is contained in:
parent
ccb28d8305
commit
80257886f5
@ -20,12 +20,12 @@ class SuperAdmin::InstanceStatusesController < SuperAdmin::ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def instance_meta
|
def instance_meta
|
||||||
context = if ActiveRecord::Base.respond_to?(:connection_pool)
|
@metrics['Database Migrations'] = begin
|
||||||
ActiveRecord::Base.connection_pool.migration_context
|
ActiveRecord::Base.connection.migration_context.needs_migration? ? 'pending' : 'completed'
|
||||||
else
|
rescue StandardError => e
|
||||||
ActiveRecord::Base.connection.migration_context
|
Rails.logger.warn "Migration context check failed: #{e.message}"
|
||||||
end
|
'unknown'
|
||||||
@metrics['Database Migrations'] = context.needs_migration? ? 'pending' : 'completed'
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def chatwoot_version
|
def chatwoot_version
|
||||||
|
|||||||
@ -77,7 +77,6 @@ class Inbox < ApplicationRecord
|
|||||||
has_one :agent_bot, through: :agent_bot_inbox
|
has_one :agent_bot, through: :agent_bot_inbox
|
||||||
has_many :webhooks, dependent: :destroy_async
|
has_many :webhooks, dependent: :destroy_async
|
||||||
has_many :hooks, dependent: :destroy_async, class_name: 'Integrations::Hook'
|
has_many :hooks, dependent: :destroy_async, class_name: 'Integrations::Hook'
|
||||||
has_many :inbox_automations, dependent: :destroy_async, class_name: '::Captain::InboxAutomation'
|
|
||||||
|
|
||||||
# Jasmine
|
# Jasmine
|
||||||
has_one :jasmine_inbox_config, class_name: 'Jasmine::InboxConfig', dependent: :destroy
|
has_one :jasmine_inbox_config, class_name: 'Jasmine::InboxConfig', dependent: :destroy
|
||||||
|
|||||||
@ -42,8 +42,7 @@ module Chatwoot
|
|||||||
config.eager_load_paths << Rails.root.join('enterprise/lib')
|
config.eager_load_paths << Rails.root.join('enterprise/lib')
|
||||||
config.eager_load_paths << Rails.root.join('enterprise/listeners')
|
config.eager_load_paths << Rails.root.join('enterprise/listeners')
|
||||||
# rubocop:disable Rails/FilePath
|
# rubocop:disable Rails/FilePath
|
||||||
enterprise_app_paths = Dir["#{Rails.root}/enterprise/app/*"].reject { |path| %w[views javascript assets].include?(File.basename(path)) }
|
config.eager_load_paths += Dir["#{Rails.root}/enterprise/app/**"]
|
||||||
config.eager_load_paths += enterprise_app_paths
|
|
||||||
# rubocop:enable Rails/FilePath
|
# rubocop:enable Rails/FilePath
|
||||||
# Add enterprise views to the view paths
|
# Add enterprise views to the view paths
|
||||||
config.paths['app/views'].unshift('enterprise/app/views')
|
config.paths['app/views'].unshift('enterprise/app/views')
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
module Enterprise::Inbox
|
module Enterprise::Inbox
|
||||||
|
# member_ids_with_assignment_capacity is used in enterprise to check for agent capacity
|
||||||
|
|
||||||
def member_ids_with_assignment_capacity
|
def member_ids_with_assignment_capacity
|
||||||
return super unless enable_auto_assignment?
|
return super unless enable_auto_assignment?
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user