Restructure omni services and add Chatwoot research snapshot

This commit is contained in:
Ruslan Bakiev
2026-02-21 11:11:27 +07:00
parent edea7a0034
commit b73babbbf6
7732 changed files with 978203 additions and 32 deletions

View File

@@ -0,0 +1,17 @@
class Notification::RemoveDuplicateNotificationJob < ApplicationJob
queue_as :default
def perform(notification)
return unless notification.is_a?(Notification)
user_id = notification.user_id
primary_actor_id = notification.primary_actor_id
# Find older notifications with the same user and primary_actor_id
duplicate_notifications = Notification.where(user_id: user_id, primary_actor_id: primary_actor_id)
.order(created_at: :desc)
# Skip the first one (the latest notification) and destroy the rest
duplicate_notifications.offset(1).each(&:destroy)
end
end