iachat/app/controllers/api/v1
Aakash Bakhle dc0e5eb465
fix: optimize message query with account_id filter (#13759)
## Description

This PR optimizes message queries by explicitly filtering with
`account_id` so the database can use the existing indexes more
efficiently.

Changes:
- Add `account_id` to message query filters to improve index
utilization.
- Update `last_incoming_message` query to include `account_id`.
- Avoid unnecessary preloading of `contact_inboxes` where it is not
required.
- Update specs to ensure `account_id` is set correctly in
message-related tests.

These changes reduce query cost and improve performance for message
lookups, especially on large accounts.

---------

Co-authored-by: Pranav <pranav@chatwoot.com>
2026-03-10 16:46:20 -07:00
..
accounts fix: optimize message query with account_id filter (#13759) 2026-03-10 16:46:20 -07:00
integrations feat: Slack link unfurling (#7940) 2023-09-29 19:35:56 +05:30
profile feat: MFA (#12290) 2025-09-18 20:19:24 +05:30
widget fix: disable email transcript for free plans (#13509) 2026-02-11 21:21:36 +05:30
accounts_controller.rb fix(signup): normalize account signup config checks (#13745) 2026-03-10 16:35:09 +05:30
notification_subscriptions_controller.rb fix: Remove the notification subscription if present (#5510) 2022-09-27 12:36:57 -07:00
profiles_controller.rb feat: Ability to reset api_access_token (#11565) 2025-05-29 14:42:13 +05:30
webhooks_controller.rb chore: Upgrade Exception tracking (#4638) 2022-05-09 14:23:19 +05:30