feat(perf): Cache labels on the conversation model (#8527)
This commit is contained in:
@@ -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?
|
||||
|
||||
Reference in New Issue
Block a user