fix: last incoming message sort (#4972)
This commit is contained in:
@@ -11,14 +11,14 @@ module SortHandler
|
||||
end
|
||||
|
||||
def self.last_messaged_conversations
|
||||
Message.except(:order).select('DISTINCT ON (conversation_id) *').order('conversation_id, created_at DESC')
|
||||
Message.except(:order).select(
|
||||
'DISTINCT ON (conversation_id) conversation_id, id, created_at, message_type'
|
||||
).order('conversation_id, created_at DESC')
|
||||
end
|
||||
|
||||
def self.sort_on_last_user_message_at
|
||||
where(
|
||||
'grouped_conversations.message_type = 0'
|
||||
).order(
|
||||
'grouped_conversations.created_at ASC'
|
||||
order(
|
||||
'grouped_conversations.message_type', 'grouped_conversations.created_at ASC'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user