feat: Add a sort option for conversations waiting for a reply from an agent (#7364)

This commit is contained in:
Pranav Raj S
2023-06-21 13:20:39 -07:00
committed by GitHub
parent e6a49b5800
commit 93daaea19b
15 changed files with 166 additions and 39 deletions

View File

@@ -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