feat: reclaim response_bot flag for custom_tools (#13897)
Repurpose the deprecated response_bot feature flag slot for custom_tools. Migration disables the flag on any accounts that had response_bot enabled so the repurposed slot starts in its default-off state. Pre-deploy: run the disable script on production using the old flag name (response_bot) before deploying this migration.
This commit is contained in:
@@ -104,10 +104,10 @@
|
||||
display_name: Audit Logs
|
||||
enabled: false
|
||||
premium: true
|
||||
- name: response_bot
|
||||
display_name: Response Bot
|
||||
- name: custom_tools
|
||||
display_name: Custom Tools
|
||||
enabled: false
|
||||
deprecated: true
|
||||
premium: true
|
||||
- name: message_reply_to
|
||||
display_name: Message Reply To
|
||||
enabled: false
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
class RepurposeResponseBotFlagForCustomTools < ActiveRecord::Migration[7.1]
|
||||
def up
|
||||
# The response_bot flag (deprecated) has been renamed to custom_tools.
|
||||
# Disable it on any accounts that had response_bot enabled so the repurposed
|
||||
# flag starts in its intended default-off state.
|
||||
Account.feature_custom_tools.find_each(batch_size: 100) do |account|
|
||||
account.disable_features(:custom_tools)
|
||||
account.save!(validate: false)
|
||||
end
|
||||
|
||||
# Remove the stale response_bot entry from ACCOUNT_LEVEL_FEATURE_DEFAULTS.
|
||||
# ConfigLoader only adds new flags; it never removes renamed ones.
|
||||
# Leaving it would cause NoMethodError in enable_default_features when
|
||||
# creating new accounts (feature_response_bot= no longer exists).
|
||||
config = InstallationConfig.find_by(name: 'ACCOUNT_LEVEL_FEATURE_DEFAULTS')
|
||||
return if config&.value.blank?
|
||||
|
||||
config.value = config.value.reject { |f| f['name'] == 'response_bot' }
|
||||
config.save!
|
||||
GlobalConfig.clear_cache
|
||||
end
|
||||
end
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.1].define(version: 2026_03_20_074636) do
|
||||
ActiveRecord::Schema[7.1].define(version: 2026_03_24_102005) do
|
||||
# These extensions should be enabled to support this database
|
||||
enable_extension "pg_stat_statements"
|
||||
enable_extension "pg_trgm"
|
||||
|
||||
Reference in New Issue
Block a user