Chore: Fix failing sidekiq events for contact create (#966)
This commit is contained in:
@@ -38,8 +38,8 @@ class Contact < ApplicationRecord
|
||||
has_many :messages, dependent: :destroy
|
||||
|
||||
before_validation :downcase_email
|
||||
after_create :dispatch_create_event
|
||||
after_update :dispatch_update_event
|
||||
after_create_commit :dispatch_create_event
|
||||
after_update_commit :dispatch_update_event
|
||||
|
||||
def get_source_id(inbox_id)
|
||||
contact_inboxes.find_by!(inbox_id: inbox_id).source_id
|
||||
|
||||
@@ -41,8 +41,12 @@ class Notification::PushNotificationService
|
||||
app_account_conversation_url(account_id: conversation.account_id, id: conversation.display_id)
|
||||
end
|
||||
|
||||
def send_browser_push?(subscription)
|
||||
ENV['VAPID_PUBLIC_KEY'] && subscription.browser_push?
|
||||
end
|
||||
|
||||
def send_browser_push(subscription)
|
||||
return unless subscription.browser_push?
|
||||
return unless send_browser_push?(subscription)
|
||||
|
||||
Webpush.payload_send(
|
||||
message: JSON.generate(push_message),
|
||||
@@ -63,6 +67,7 @@ class Notification::PushNotificationService
|
||||
end
|
||||
|
||||
def send_fcm_push(subscription)
|
||||
return unless ENV['FCM_SERVER_KEY']
|
||||
return unless subscription.fcm?
|
||||
|
||||
fcm = FCM.new(ENV['FCM_SERVER_KEY'])
|
||||
|
||||
Reference in New Issue
Block a user