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>
69 lines
2.0 KiB
Ruby
69 lines
2.0 KiB
Ruby
class Internal::Accounts::InternalAttributesService
|
|
attr_reader :account
|
|
|
|
# List of keys that can be managed through this service
|
|
# TODO: Add account_notes field in future
|
|
# This field can be used to store notes about account on Chatwoot cloud
|
|
VALID_KEYS = %w[manually_managed_features].freeze
|
|
|
|
def initialize(account)
|
|
@account = account
|
|
end
|
|
|
|
# Get a value from internal_attributes
|
|
def get(key)
|
|
validate_key!(key)
|
|
account.internal_attributes[key]
|
|
end
|
|
|
|
# Set a value in internal_attributes
|
|
def set(key, value)
|
|
validate_key!(key)
|
|
|
|
# Create a new hash to avoid modifying the original
|
|
new_attrs = account.internal_attributes.dup || {}
|
|
new_attrs[key] = value
|
|
|
|
# Update the account
|
|
account.internal_attributes = new_attrs
|
|
account.save
|
|
end
|
|
|
|
# Get manually managed features
|
|
def manually_managed_features
|
|
get('manually_managed_features') || []
|
|
end
|
|
|
|
# Set manually managed features
|
|
def manually_managed_features=(features)
|
|
features = [] if features.nil?
|
|
features = [features] unless features.is_a?(Array)
|
|
|
|
# Clean up the array: remove empty strings, whitespace, and validate against valid features
|
|
valid_features = valid_feature_list
|
|
features = features.compact
|
|
.map(&:strip)
|
|
.reject(&:empty?)
|
|
.select { |f| valid_features.include?(f) }
|
|
.uniq
|
|
|
|
set('manually_managed_features', features)
|
|
end
|
|
|
|
# Get list of valid features that can be manually managed
|
|
def valid_feature_list
|
|
# Business and Enterprise plan features only
|
|
Enterprise::Billing::HandleStripeEventService::BUSINESS_PLAN_FEATURES +
|
|
Enterprise::Billing::HandleStripeEventService::ENTERPRISE_PLAN_FEATURES
|
|
end
|
|
|
|
# Account notes functionality removed for now
|
|
# Will be re-implemented when UI is ready
|
|
|
|
private
|
|
|
|
def validate_key!(key)
|
|
raise ArgumentError, "Invalid internal attribute key: #{key}" unless VALID_KEYS.include?(key)
|
|
end
|
|
end
|