Some checks failed
Lock Threads / action (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot EE docker images / merge (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot CE docker images / merge (push) Has been cancelled
Run Chatwoot CE spec / lint-backend (push) Has been cancelled
Run Chatwoot CE spec / lint-frontend (push) Has been cancelled
Run Chatwoot CE spec / frontend-tests (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (0, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (1, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (10, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (11, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (12, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (13, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (14, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (15, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (2, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (3, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (4, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (5, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (6, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (7, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (8, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (9, 16) (push) Has been cancelled
Run Linux nightly installer / nightly (push) Has been cancelled
- Add Logistics component with progress tracking - Add OrderDetail component for order information - Support data-driven steps and actions - Add blue color scale to widget SCSS - Fix node overflow and progress bar rendering issues - Add English translations for dashboard components Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
60 lines
1.7 KiB
Ruby
60 lines
1.7 KiB
Ruby
class Internal::ReconcilePlanConfigService
|
|
def perform
|
|
remove_premium_config_reset_warning
|
|
return if ChatwootHub.pricing_plan != 'community'
|
|
|
|
create_premium_config_reset_warning if premium_config_reset_required?
|
|
|
|
reconcile_premium_config
|
|
reconcile_premium_features
|
|
end
|
|
|
|
private
|
|
|
|
def config_path
|
|
@config_path ||= Rails.root.join('enterprise/config')
|
|
end
|
|
|
|
def premium_config
|
|
@premium_config ||= YAML.safe_load(File.read("#{config_path}/premium_installation_config.yml")).freeze
|
|
end
|
|
|
|
def remove_premium_config_reset_warning
|
|
Redis::Alfred.delete(Redis::Alfred::CHATWOOT_INSTALLATION_CONFIG_RESET_WARNING)
|
|
end
|
|
|
|
def create_premium_config_reset_warning
|
|
Redis::Alfred.set(Redis::Alfred::CHATWOOT_INSTALLATION_CONFIG_RESET_WARNING, true)
|
|
end
|
|
|
|
def premium_config_reset_required?
|
|
premium_config.any? do |config|
|
|
config = config.with_indifferent_access
|
|
existing_config = InstallationConfig.find_by(name: config[:name])
|
|
existing_config&.value != config[:value] if existing_config.present?
|
|
end
|
|
end
|
|
|
|
def reconcile_premium_config
|
|
premium_config.each do |config|
|
|
new_config = config.with_indifferent_access
|
|
existing_config = InstallationConfig.find_by(name: new_config[:name])
|
|
next if existing_config&.value == new_config[:value]
|
|
|
|
existing_config&.update!(value: new_config[:value])
|
|
end
|
|
end
|
|
|
|
def premium_features
|
|
@premium_features ||= YAML.safe_load(File.read("#{config_path}/premium_features.yml")).freeze
|
|
end
|
|
|
|
def reconcile_premium_features
|
|
Account.find_in_batches do |accounts|
|
|
accounts.each do |account|
|
|
account.disable_features!(*premium_features)
|
|
end
|
|
end
|
|
end
|
|
end
|