Files
leadchat/app/helpers/super_admin/account_features_helper.rb
Sojan Jose 3b141fca28 chore: Add internal feature flags for Chatwoot Cloud (#10902)
This PR introduces internal feature flags for testing purposes. These
flags will not be displayed on regular instances to prevent customer
confusion.

Additionally, a new feature flag, `contact_chatwoot_support_team`, has
been added for Chatwoot Cloud. This flag disables contact support for
third-party onboarded accounts, as support will be handled by the
original affiliate team.

Co-authored-by: Pranav <pranav@chatwoot.com>
2025-02-15 16:21:46 -08:00

20 lines
662 B
Ruby

module SuperAdmin::AccountFeaturesHelper
def self.account_features
YAML.safe_load(Rails.root.join('config/features.yml').read).freeze
end
def self.account_premium_features
account_features.filter { |feature| feature['premium'] }.pluck('name')
end
# Accepts account.features as argument
def self.filtered_features(features)
deployment_env = GlobalConfig.get_value('DEPLOYMENT_ENV')
return features if deployment_env == 'cloud'
# Filter out internal features for non-cloud environments
internal_features = account_features.select { |f| f['chatwoot_internal'] }.pluck('name')
features.except(*internal_features)
end
end