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
|
||||
|
||||
def instance_meta
|
||||
context = if ActiveRecord::Base.respond_to?(:connection_pool)
|
||||
ActiveRecord::Base.connection_pool.migration_context
|
||||
else
|
||||
ActiveRecord::Base.connection.migration_context
|
||||
end
|
||||
@metrics['Database Migrations'] = context.needs_migration? ? 'pending' : 'completed'
|
||||
@metrics['Database Migrations'] = begin
|
||||
ActiveRecord::Base.connection.migration_context.needs_migration? ? 'pending' : 'completed'
|
||||
rescue StandardError => e
|
||||
Rails.logger.warn "Migration context check failed: #{e.message}"
|
||||
'unknown'
|
||||
end
|
||||
end
|
||||
|
||||
def chatwoot_version
|
||||
|
||||
@ -77,7 +77,6 @@ class Inbox < ApplicationRecord
|
||||
has_one :agent_bot, through: :agent_bot_inbox
|
||||
has_many :webhooks, dependent: :destroy_async
|
||||
has_many :hooks, dependent: :destroy_async, class_name: 'Integrations::Hook'
|
||||
has_many :inbox_automations, dependent: :destroy_async, class_name: '::Captain::InboxAutomation'
|
||||
|
||||
# Jasmine
|
||||
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/listeners')
|
||||
# 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 += enterprise_app_paths
|
||||
config.eager_load_paths += Dir["#{Rails.root}/enterprise/app/**"]
|
||||
# rubocop:enable Rails/FilePath
|
||||
# Add enterprise views to the view paths
|
||||
config.paths['app/views'].unshift('enterprise/app/views')
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
module Enterprise::Inbox
|
||||
# member_ids_with_assignment_capacity is used in enterprise to check for agent capacity
|
||||
|
||||
def member_ids_with_assignment_capacity
|
||||
return super unless enable_auto_assignment?
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user