feat(perf): Cache labels on the conversation model (#8527)

This commit is contained in:
Pranav Raj S
2023-12-11 18:27:55 -08:00
committed by GitHub
parent 79412ba2c6
commit 890515edfd
9 changed files with 48 additions and 53 deletions

View File

@@ -6,6 +6,7 @@
# additional_attributes :jsonb
# agent_last_seen_at :datetime
# assignee_last_seen_at :datetime
# cached_label_list :string
# contact_last_seen_at :datetime
# custom_attributes :jsonb
# first_reply_created_at :datetime
@@ -144,10 +145,6 @@ class Conversation < ApplicationRecord
end
end
def update_assignee(agent = nil)
update!(assignee: agent)
end
def toggle_status
# FIXME: implement state machine with aasm
self.status = open? ? :resolved : :open
@@ -185,6 +182,10 @@ class Conversation < ApplicationRecord
Conversations::EventDataPresenter.new(self).push_data
end
def cached_label_list_array
(cached_label_list || '').split(',')
end
def notifiable_assignee_change?
return false unless saved_change_to_assignee_id?
return false if assignee_id.blank?