Class: ActivityCrmNavbarRefreshHandler
- Inherits:
-
Object
- Object
- ActivityCrmNavbarRefreshHandler
- Defined in:
- app/subscribers/activity_crm_navbar_refresh_handler.rb
Overview
Refreshes every live CRM user's email badge whenever an inbound-email
Activity is created or whose result type changes (which moves it in/out of
the open-activities scope used by CrmNavbarCounts#unread_email).
Subscribes to: Events::ActivityCreated, Events::ActivityUpdated
Filtered narrowly so we only enqueue work that can actually move the badge:
- on create: only inbound-email activity types
- on update: only when activity_result_type_id changed (open <-> closed)
Coalescing happens inside CrmNavbarRefreshWorker.
Flat-named per the project's zeitwerk-flat-namespace rule (Activity is an
AR model; nesting under Activity::* invites superclass races at eager-load).
Instance Method Summary collapse
Instance Method Details
#call(event) ⇒ Object
18 19 20 21 22 |
# File 'app/subscribers/activity_crm_navbar_refresh_handler.rb', line 18 def call(event) return unless email_badge_relevant?(event) CrmNavbarFanoutWorker.perform_async('email') end |