feat: UI to show the SLA threshold in chat screen (#9146)
- UI will show the breach in the conversation list. - UI will show the breach in the conversation header. Fixes: https://linear.app/chatwoot/issue/CW-3146/update-the-ui-to-show-the-breach-in-the-conversation-list Fixes: https://linear.app/chatwoot/issue/CW-3144/ui-update-to-show-the-breachgoing-to-breach
This commit is contained in:
@@ -57,6 +57,7 @@ class Conversation < ApplicationRecord
|
||||
include ActivityMessageHandler
|
||||
include UrlHelper
|
||||
include SortHandler
|
||||
include PushDataHelper
|
||||
include ConversationMuteHelpers
|
||||
|
||||
validates :account_id, presence: true
|
||||
@@ -171,18 +172,6 @@ class Conversation < ApplicationRecord
|
||||
unread_messages.where(account_id: account_id).incoming.last(10)
|
||||
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 cached_label_list_array
|
||||
(cached_label_list || '').split(',').map(&:strip)
|
||||
end
|
||||
@@ -207,6 +196,10 @@ class Conversation < ApplicationRecord
|
||||
"#{ENV.fetch('FRONTEND_URL', nil)}/survey/responses/#{uuid}"
|
||||
end
|
||||
|
||||
def dispatch_conversation_updated_event(previous_changes = nil)
|
||||
dispatcher_dispatch(CONVERSATION_UPDATED, previous_changes)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def execute_after_update_commit_callbacks
|
||||
@@ -245,13 +238,17 @@ class Conversation < ApplicationRecord
|
||||
def notify_conversation_updation
|
||||
return unless previous_changes.keys.present? && allowed_keys?
|
||||
|
||||
dispatcher_dispatch(CONVERSATION_UPDATED, previous_changes)
|
||||
dispatch_conversation_updated_event(previous_changes)
|
||||
end
|
||||
|
||||
def list_of_keys
|
||||
%w[team_id assignee_id status snoozed_until custom_attributes label_list waiting_since first_reply_created_at
|
||||
priority]
|
||||
end
|
||||
|
||||
def allowed_keys?
|
||||
(
|
||||
previous_changes.keys.intersect?(%w[team_id assignee_id status snoozed_until custom_attributes label_list waiting_since first_reply_created_at
|
||||
priority]) ||
|
||||
previous_changes.keys.intersect?(list_of_keys) ||
|
||||
(previous_changes['additional_attributes'].present? && previous_changes['additional_attributes'][1].keys.intersect?(%w[conversation_language]))
|
||||
)
|
||||
end
|
||||
@@ -314,3 +311,4 @@ end
|
||||
|
||||
Conversation.include_mod_with('Concerns::Conversation')
|
||||
Conversation.include_mod_with('SentimentAnalysisHelper')
|
||||
Conversation.prepend_mod_with('Conversation')
|
||||
|
||||
Reference in New Issue
Block a user