feat: Add a sort option for conversations waiting for a reply from an agent (#7364)
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
# snoozed_until :datetime
|
||||
# status :integer default("open"), not null
|
||||
# uuid :uuid not null
|
||||
# waiting_since :datetime
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
@@ -45,6 +46,7 @@
|
||||
# index_conversations_on_status_and_priority (status,priority)
|
||||
# index_conversations_on_team_id (team_id)
|
||||
# index_conversations_on_uuid (uuid) UNIQUE
|
||||
# index_conversations_on_waiting_since (waiting_since)
|
||||
#
|
||||
|
||||
class Conversation < ApplicationRecord
|
||||
@@ -101,6 +103,7 @@ class Conversation < ApplicationRecord
|
||||
|
||||
before_save :ensure_snooze_until_reset
|
||||
before_create :mark_conversation_pending_if_bot
|
||||
before_create :ensure_waiting_since
|
||||
|
||||
after_update_commit :execute_after_update_commit_callbacks
|
||||
after_create_commit :notify_conversation_creation
|
||||
@@ -214,6 +217,10 @@ class Conversation < ApplicationRecord
|
||||
self.snoozed_until = nil unless snoozed?
|
||||
end
|
||||
|
||||
def ensure_waiting_since
|
||||
self.waiting_since = Time.now.utc
|
||||
end
|
||||
|
||||
def validate_additional_attributes
|
||||
self.additional_attributes = {} unless additional_attributes.is_a?(Hash)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user