Feature: User Notification Objects (#752)

Co-authored-by: Pranav Raj S <pranavrajs@gmail.com>
This commit is contained in:
Sojan Jose
2020-05-01 14:53:43 +05:30
committed by GitHub
parent 66aace7c13
commit 96da27f1f6
35 changed files with 461 additions and 110 deletions

View File

@@ -53,7 +53,7 @@ class Conversation < ApplicationRecord
before_create :set_bot_conversation
after_update :notify_status_change, :create_activity, :send_email_notification_to_assignee
after_update :notify_status_change, :create_activity
after_create :notify_conversation_creation, :run_round_robin
@@ -105,16 +105,6 @@ class Conversation < ApplicationRecord
}
end
private
def set_bot_conversation
self.status = :bot if inbox.agent_bot_inbox&.active?
end
def notify_conversation_creation
dispatcher_dispatch(CONVERSATION_CREATED)
end
def notifiable_assignee_change?
return false if self_assign?(assignee_id)
return false unless saved_change_to_assignee_id?
@@ -123,12 +113,14 @@ class Conversation < ApplicationRecord
true
end
def send_email_notification_to_assignee
return unless notifiable_assignee_change?
return if assignee.notification_settings.find_by(account_id: account_id).not_conversation_assignment?
return if bot?
private
AgentNotifications::ConversationNotificationsMailer.conversation_assigned(self, assignee).deliver_later
def set_bot_conversation
self.status = :bot if inbox.agent_bot_inbox&.active?
end
def notify_conversation_creation
dispatcher_dispatch(CONVERSATION_CREATED)
end
def self_assign?(assignee_id)