diff --git a/app/models/concerns/conversation_presentation_helper.rb b/app/models/concerns/conversation_presentation_helper.rb new file mode 100644 index 000000000..a0ad201f2 --- /dev/null +++ b/app/models/concerns/conversation_presentation_helper.rb @@ -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 diff --git a/app/models/conversation.rb b/app/models/conversation.rb index cf9e9fb84..45cc60f20 100644 --- a/app/models/conversation.rb +++ b/app/models/conversation.rb @@ -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?