diff --git a/config/features.yml b/config/features.yml index 03105588b..cffa88588 100644 --- a/config/features.yml +++ b/config/features.yml @@ -216,10 +216,11 @@ display_name: Reply Mailer Migration enabled: false chatwoot_internal: true -- name: quoted_email_reply - display_name: Quoted Email Reply +- name: billing_currency_switch + display_name: Billing Currency Switch enabled: false - deprecated: true + premium: true + chatwoot_internal: true - name: companies display_name: Companies enabled: false diff --git a/db/migrate/20260615000000_repurpose_quoted_email_reply_flag_for_billing_currency_switch.rb b/db/migrate/20260615000000_repurpose_quoted_email_reply_flag_for_billing_currency_switch.rb new file mode 100644 index 000000000..083b44570 --- /dev/null +++ b/db/migrate/20260615000000_repurpose_quoted_email_reply_flag_for_billing_currency_switch.rb @@ -0,0 +1,20 @@ +class RepurposeQuotedEmailReplyFlagForBillingCurrencySwitch < ActiveRecord::Migration[7.1] + def up + # The quoted_email_reply flag (deprecated) has been renamed to billing_currency_switch. + # They share a bit position, so disable it on any accounts that had quoted_email_reply + # enabled — otherwise they would silently start with billing_currency_switch on. + Account.feature_billing_currency_switch.find_each(batch_size: 100) do |account| + account.disable_features(:billing_currency_switch) + account.save!(validate: false) + end + + # Remove the stale quoted_email_reply entry from ACCOUNT_LEVEL_FEATURE_DEFAULTS. + # ConfigLoader only adds new flags; it never removes renamed ones. + config = InstallationConfig.find_by(name: 'ACCOUNT_LEVEL_FEATURE_DEFAULTS') + return if config&.value.blank? + + config.value = config.value.reject { |feature| feature['name'] == 'quoted_email_reply' } + config.save! + GlobalConfig.clear_cache + end +end diff --git a/db/schema.rb b/db/schema.rb index 2060bcfda..c7696743b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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_06_11_184600) do +ActiveRecord::Schema[7.1].define(version: 2026_06_15_000000) do # These extensions should be enabled to support this database enable_extension "pg_stat_statements" enable_extension "pg_trgm" @@ -73,6 +73,10 @@ ActiveRecord::Schema[7.1].define(version: 2026_06_11_184600) do t.integer "status", default: 0 t.jsonb "internal_attributes", default: {}, null: false t.jsonb "settings", default: {} + t.integer "open_conversations_count", default: 0, null: false + t.integer "resolved_conversations_count", default: 0, null: false + t.integer "pending_conversations_count", default: 0, null: false + t.integer "snoozed_conversations_count", default: 0, null: false t.index ["status"], name: "index_accounts_on_status" end @@ -200,8 +204,8 @@ ActiveRecord::Schema[7.1].define(version: 2026_06_11_184600) do t.text "description" t.integer "assignment_order", default: 0, null: false t.integer "conversation_priority", default: 0, null: false - t.integer "fair_distribution_limit", default: 100, null: false - t.integer "fair_distribution_window", default: 3600, null: false + t.integer "fair_distribution_limit", default: 1, null: false + t.integer "fair_distribution_window", default: 60, null: false t.boolean "enabled", default: true, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false @@ -279,8 +283,11 @@ ActiveRecord::Schema[7.1].define(version: 2026_06_11_184600) do t.text "transcript" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.string "media_session_id" + t.index ["accepted_by_agent_id", "status"], name: "index_calls_on_accepted_by_agent_id_and_status" t.index ["account_id", "contact_id"], name: "index_calls_on_account_id_and_contact_id" t.index ["account_id", "conversation_id"], name: "index_calls_on_account_id_and_conversation_id" + t.index ["media_session_id"], name: "index_calls_on_media_session_id", unique: true t.index ["message_id"], name: "index_calls_on_message_id" t.index ["provider", "provider_call_id"], name: "index_calls_on_provider_and_provider_call_id", unique: true end @@ -473,8 +480,10 @@ ActiveRecord::Schema[7.1].define(version: 2026_06_11_184600) do t.boolean "smtp_enable_ssl_tls", default: false t.jsonb "provider_config", default: {} t.string "provider" - t.string "imap_authentication", default: "plain" t.boolean "verified_for_sending", default: false, null: false + t.integer "imap_retry_count", default: 0, null: false + t.datetime "imap_retry_after" + t.string "imap_authentication", default: "plain" t.index ["email"], name: "index_channel_email_on_email", unique: true t.index ["forward_to_email"], name: "index_channel_email_on_forward_to_email", unique: true end @@ -1326,6 +1335,27 @@ ActiveRecord::Schema[7.1].define(version: 2026_06_11_184600) do t.index ["account_id", "url"], name: "index_webhooks_on_account_id_and_url", unique: true end + create_table "whatsapp_calls", force: :cascade do |t| + t.bigint "account_id", null: false + t.bigint "inbox_id", null: false + t.bigint "conversation_id", null: false + t.bigint "accepted_by_agent_id" + t.string "call_id", null: false + t.string "direction", null: false + t.string "status", default: "ringing", null: false + t.integer "duration_seconds" + t.string "end_reason" + t.jsonb "meta", default: {}, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.bigint "message_id" + t.text "transcript" + t.index ["account_id", "conversation_id"], name: "index_whatsapp_calls_on_account_id_and_conversation_id" + t.index ["call_id"], name: "index_whatsapp_calls_on_call_id", unique: true + t.index ["inbox_id", "status"], name: "index_whatsapp_calls_on_inbox_id_and_status" + t.index ["message_id"], name: "index_whatsapp_calls_on_message_id" + end + create_table "working_hours", force: :cascade do |t| t.bigint "inbox_id" t.bigint "account_id" @@ -1346,6 +1376,7 @@ ActiveRecord::Schema[7.1].define(version: 2026_06_11_184600) do add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id" add_foreign_key "inboxes", "portals" add_foreign_key "user_sessions", "users" + add_foreign_key "whatsapp_calls", "messages" create_trigger("accounts_after_insert_row_tr", :generated => true, :compatibility => 1). on("accounts"). after(:insert).