feat: sort conversation on priority (#6943)
* feat: update seed script to include prioritt * feat: add sort_handler for conversations * test: sort on priority order --------- Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
This commit is contained in:
@@ -21,5 +21,13 @@ module SortHandler
|
||||
'grouped_conversations.message_type', 'grouped_conversations.created_at ASC'
|
||||
)
|
||||
end
|
||||
|
||||
def self.sort_on_priority
|
||||
order(
|
||||
Arel::Nodes::SqlLiteral.new(
|
||||
sanitize_sql_for_order('CASE WHEN priority IS NULL THEN 0 ELSE priority END DESC, last_activity_at DESC')
|
||||
)
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user