refactor: move event data fns to separate concern
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
module ConversationPresentationHelper
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def push_event_data
|
||||
Conversations::EventDataPresenter.new(self).push_data
|
||||
end
|
||||
|
||||
def lock_event_data
|
||||
Conversations::EventDataPresenter.new(self).lock_data
|
||||
end
|
||||
|
||||
def webhook_data
|
||||
Conversations::EventDataPresenter.new(self).push_data
|
||||
end
|
||||
end
|
||||
@@ -59,6 +59,7 @@ class Conversation < ApplicationRecord
|
||||
include UrlHelper
|
||||
include SortHandler
|
||||
include ConversationMuteHelpers
|
||||
include ConversationPresentationHelper
|
||||
|
||||
validates :account_id, presence: true
|
||||
validates :inbox_id, presence: true
|
||||
@@ -183,18 +184,6 @@ class Conversation < ApplicationRecord
|
||||
messages.incoming.unread_since(agent_last_seen_at)
|
||||
end
|
||||
|
||||
def push_event_data
|
||||
Conversations::EventDataPresenter.new(self).push_data
|
||||
end
|
||||
|
||||
def lock_event_data
|
||||
Conversations::EventDataPresenter.new(self).lock_data
|
||||
end
|
||||
|
||||
def webhook_data
|
||||
Conversations::EventDataPresenter.new(self).push_data
|
||||
end
|
||||
|
||||
def notifiable_assignee_change?
|
||||
return false unless saved_change_to_assignee_id?
|
||||
return false if assignee_id.blank?
|
||||
|
||||
Reference in New Issue
Block a user