chatwoot/app/models
Tanmay Deep Sharma d526cf283d
fix: pass serialized data in notification.deleted event to avoid Deserialisation (#13061)
https://one.newrelic.com/alerts/issue?account=3437125&duration=259200000&state=d088e9b7-d0ce-3fcf-fda5-145df8b9cb2a


## Description
Pass serialized data instead of ActiveRecord object in
dispatch_destroy_event to prevent ActiveJob::DeserializationError when
the notification is already deleted.

This error occurs frequently because RemoveDuplicateNotificationJob
deletes notifications, and by the time the async EventDispatcherJob
runs, the record no longer exists.

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)

## How Has This Been Tested?



## Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented on my code, particularly in hard-to-understand
areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream
modules


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Avoids ActiveJob deserialization failures by sending serialized data
for notification deletion and updating the listener accordingly.
> 
> - `Notification#dispatch_destroy_event` now dispatches
`NOTIFICATION_DELETED` with serialized `notification_data` (`id`,
`user_id`, `account_id`) instead of the AR object
> - `ActionCableListener#notification_deleted` reads
`notification_data`, finds `User`/`Account`, computes
`unread_count`/`count` via `NotificationFinder`, and broadcasts using
the user’s pubsub token
> - Specs updated to pass `notification_data` and assert payload
(including `unread_count`/`count`)
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
e2ffbe765b. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Vishnu Narayanan <iamwishnu@gmail.com>
2026-01-12 13:15:40 +05:30
..
channel feat: TikTok channel (#12741) 2025-12-17 07:54:50 -08:00
concerns feat: TikTok channel (#12741) 2025-12-17 07:54:50 -08:00
integrations fix: hide linear card when not enabled (#12918) 2025-12-08 20:49:50 +05:30
access_token.rb
account_user.rb
account.rb feat: TikTok channel (#12741) 2025-12-17 07:54:50 -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
assignment_policy.rb chore(annotations): sync model annotations with current schema (#12245) 2025-08-20 20:23:42 +02:00
attachment.rb feat: TikTok channel (#12741) 2025-12-17 07:54:50 -08:00
automation_rule.rb feat: Add support for labels in automations (#11658) 2025-09-18 14:17:54 +05:30
campaign.rb
canned_response.rb
category.rb chore: Increase Category index per-page limit to 1000 (#12282) 2025-08-22 12:41:38 -07:00
contact_inbox.rb fix: Change contact_inboxes.source_id to text column (#12882) 2025-11-17 16:09:36 +05:30
contact.rb feat: Add company model and API with tests (#12548) 2025-10-08 07:53:43 -07:00
conversation_participant.rb
conversation.rb feat: APIs to assign agents_bots as assignee in conversations (#12836) 2025-11-18 18:20:58 -08:00
csat_survey_response.rb
custom_attribute_definition.rb feat: Conversation workflow backend changes (#13070) 2025-12-16 14:43:15 +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
folder.rb
inbox_assignment_policy.rb
inbox_member.rb
inbox.rb feat: TikTok channel (#12741) 2025-12-17 07:54:50 -08:00
installation_config.rb feat: Control the allowed login methods via Super Admin (#12892) 2025-11-17 21:55:12 -08:00
integrations.rb
jsonb_attributes_length_validator.rb
kbase.rb
label.rb
macro.rb
mention.rb
message.rb feat: allow agent bot and captain responses to reset waiting since (#13181) 2026-01-07 13:57:43 +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 SignedId instead of regular ID in portal update (#13197) 2026-01-07 19:36:29 -08:00
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 feat: Add company model and API with tests (#12548) 2025-10-08 07:53:43 -07:00
webhook.rb fix: the webhook url to be text (#13157) 2026-01-06 15:23:54 +05:30
working_hour.rb