iachat/app/models
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
..
channel fix: call authorization_error! on IMAP auth failures (#13560) (revert) (#13671) 2026-02-26 18:45:18 -08:00
concerns fix: call authorization_error! on IMAP auth failures (#13560) (revert) (#13671) 2026-02-26 18:45:18 -08:00
integrations Revert "chore: Upgrade Rails to 7.2.2 and update Gemfile dependencies (#11037)" 2026-02-03 21:09:42 -08:00
access_token.rb
account_user.rb feat: Add migration files for assignment v2 (#12147) 2025-08-11 21:44:38 -07:00
account.rb feat: Add temporary account setting to disable Captain auto-resolve (#13680) 2026-02-27 09:37:00 -08:00
agent_bot_inbox.rb
agent_bot.rb feat: APIs to assign agents_bots as assignee in conversations (#12836) 2025-11-18 18:20:58 -08:00
application_record.rb
article.rb feat(help-center): enable drag-and-drop category reordering (#13706) 2026-03-05 12:53:38 +05:30
assignment_policy.rb chore(annotations): sync model annotations with current schema (#12245) 2025-08-20 20:23:42 +02:00
attachment.rb fix: Handle Facebook reel attachment type (#13691) 2026-03-06 08:49:41 +04:00
automation_rule.rb feat: add mark pending action to automation (#13378) 2026-02-02 11:59:51 +05:30
campaign.rb feat: WhatsApp campaigns (#11910) 2025-07-16 09:04:02 +05:30
canned_response.rb
category.rb feat(help-center): enable drag-and-drop category reordering (#13706) 2026-03-05 12:53:38 +05:30
contact_inbox.rb fix: Change contact_inboxes.source_id to text column (#12882) 2025-11-17 16:09:36 +05:30
contact.rb fix: prevent deserialization error on deletion (#13264) 2026-01-14 18:00:12 +05:30
conversation_participant.rb
conversation.rb fix: optimize message query with account_id filter (#13759) 2026-03-10 16:46:20 -07:00
csat_survey_response.rb feat(ee): Review Notes for CSAT Reports (#13289) 2026-01-15 19:53:57 -08:00
custom_attribute_definition.rb feat: harden filter service 2026-03-09 21:19:20 +05:30
custom_filter.rb chore: Increase custom filter limit from 50 to 1000 per user (#12603) 2025-10-06 10:41:26 -07:00
dashboard_app.rb
data_import.rb
email_template.rb chore: upgrade ruby version to 3.4.4 (#11524) 2025-05-21 19:40:07 +05:30
folder.rb
inbox_assignment_policy.rb feat: Add assignment policies controllers with jbuilder views (#12199) 2025-08-18 19:15:21 -07:00
inbox_member.rb
inbox.rb feat: Add support for sending CSAT surveys via templates (Whatsapp Twilio) (#13143) 2026-01-13 16:32:02 +04:00
installation_config.rb Revert "chore: Upgrade Rails to 7.2.2 and update Gemfile dependencies (#11037)" 2026-02-03 21:09:42 -08:00
integrations.rb
jsonb_attributes_length_validator.rb
kbase.rb
label.rb
macro.rb feat: Add webhook event support for macros (#11235) 2025-04-02 20:26:55 -07:00
mention.rb
message.rb fix: captain talking over support agent (#13673) 2026-03-03 16:13:34 +05:30
note.rb
notification_setting.rb
notification_subscription.rb
notification.rb fix: pass serialized data in notification.deleted event to avoid Deserialisation (#13061) 2026-01-12 13:15:40 +05:30
platform_app_permissible.rb
platform_app.rb
portal.rb fix: Use page_title with fallback to name for portal display titles (#13719) 2026-03-05 14:20:31 +05:30
related_category.rb
reporting_event.rb feat: allow querying reporting events via the API (#12832) 2025-11-13 12:46:55 +05:30
super_admin.rb feat: Add company model and API with tests (#12548) 2025-10-08 07:53:43 -07:00
team_member.rb
team.rb
user.rb Revert "chore: Upgrade Rails to 7.2.2 and update Gemfile dependencies (#11037)" 2026-02-03 21:09:42 -08:00
webhook.rb feat: add per-webhook secret with backfill migration (#13573) 2026-02-26 17:26:12 +05:30
working_hour.rb