[Feature] Change conversation ordering (#640)
* Update conversation's updated_at when a message is created/saved * changed teh ordering of conversation to be based on `updated_at` rather than `created_at`
This commit is contained in:
@@ -36,7 +36,7 @@ class Conversation < ApplicationRecord
|
||||
|
||||
enum status: { open: 0, resolved: 1, bot: 2 }
|
||||
|
||||
scope :latest, -> { order(created_at: :desc) }
|
||||
scope :latest, -> { order(updated_at: :desc) }
|
||||
scope :unassigned, -> { where(assignee_id: nil) }
|
||||
scope :assigned_to, ->(agent) { where(assignee_id: agent.id) }
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ class Message < ApplicationRecord
|
||||
|
||||
belongs_to :account
|
||||
belongs_to :inbox
|
||||
belongs_to :conversation
|
||||
belongs_to :conversation, touch: true
|
||||
belongs_to :user, required: false
|
||||
belongs_to :contact, required: false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user