feat: Add a priority + created at sort for conversations (#13658)

- Add a new conversation sort option "Priority: Highest first, Created:
Oldest first" that sorts by priority descending (urgent > high > medium
> low > none) with created_at ascending as the tiebreaker
This commit is contained in:
Pranav
2026-02-25 18:22:41 -08:00
committed by GitHub
parent 9fab70aebf
commit e2dd2ccb42
6 changed files with 22 additions and 0 deletions

View File

@@ -14,6 +14,10 @@ module SortHandler
order(generate_sql_query("priority #{sort_direction.to_s.upcase} NULLS LAST, last_activity_at DESC"))
end
def sort_on_priority_created_at(sort_direction = :desc)
order(generate_sql_query("priority #{sort_direction.to_s.upcase} NULLS LAST, created_at ASC"))
end
def sort_on_waiting_since(sort_direction = :asc)
order(generate_sql_query("waiting_since #{sort_direction.to_s.upcase} NULLS LAST, created_at ASC"))
end