chatwoot/app/jobs/conversations
Tanmay Deep Sharma d451615811
fix: prevent NoMethodError in mute helpers when contact is nil (#13277)
## Linear Ticket

https://linear.app/chatwoot/issue/CW-4569/nomethoderror-undefined-method-blocked-for-nil-nomethoderror

## Description
Fixes NoMethodError in ConversationMuteHelpers that occurs during
contact deletion race condition.
When a contact is deleted, there's a brief window (~50-150ms) where
contact_id becomes nil but conversations still exist. If ResolutionJob
runs during this window, the muted? method crashes trying to call
blocked? on nil.Fixes # (issue)

## Type of change

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

## How Has This Been Tested?

- Created orphaned conversations (contact_id = nil)
- Called muted?, mute!, unmute! - all return gracefully
- Verified async deletion still works correctly

## 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



Co-authored-by: Sojan Jose <sojan@pepalo.com>
2026-01-15 22:00:09 -08:00
..
activity_message_job.rb chore: Reorganize Sidekiq Queues (#6976) 2023-05-04 15:44:16 +05:30
reopen_snoozed_conversations_job.rb chore: Use find_each instead of .all.each (#6975) 2023-04-25 09:32:35 +05:30
resolution_job.rb fix: prevent NoMethodError in mute helpers when contact is nil (#13277) 2026-01-15 22:00:09 -08:00
update_message_status_job.rb chore: move UpdateMessageStatus to deferred queue (#11943) 2025-07-16 08:19:00 +05:30
user_mention_job.rb chore: Use "create!" and "save!" bang methods when not checking the result (#5358) 2022-09-13 17:40:06 +05:30