From 48027dccb9a947478fa0e86c04aebe24c9976100 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 14 Jul 2025 19:08:04 +0000 Subject: [PATCH] Filter out chats with empty or whitespace-only titles Co-authored-by: dallin --- apps/api/libs/handlers/src/chats/list_chats_handler.rs | 2 ++ apps/api/libs/handlers/src/logs/list_logs_handler.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/apps/api/libs/handlers/src/chats/list_chats_handler.rs b/apps/api/libs/handlers/src/chats/list_chats_handler.rs index 9cc8b0b7c..81765e19f 100644 --- a/apps/api/libs/handlers/src/chats/list_chats_handler.rs +++ b/apps/api/libs/handlers/src/chats/list_chats_handler.rs @@ -106,6 +106,7 @@ pub async fn list_chats_handler( .inner_join(users::table.on(chats::created_by.eq(users::id))) .filter(chats::deleted_at.is_null()) .filter(chats::title.ne("")) // Filter out empty titles + .filter(chats::title.ne(" ")) // Filter out single space .into_boxed(); // Add user filter if not admin view @@ -143,6 +144,7 @@ pub async fn list_chats_handler( let has_more = results.len() > request.page_size as usize; let items: Vec = results .into_iter() + .filter(|chat| !chat.title.trim().is_empty()) // Filter out titles with only whitespace .take(request.page_size as usize) .map(|chat| { ChatListItem { diff --git a/apps/api/libs/handlers/src/logs/list_logs_handler.rs b/apps/api/libs/handlers/src/logs/list_logs_handler.rs index b11d7e578..4ce45bf8e 100644 --- a/apps/api/libs/handlers/src/logs/list_logs_handler.rs +++ b/apps/api/libs/handlers/src/logs/list_logs_handler.rs @@ -79,6 +79,7 @@ pub async fn list_logs_handler( .filter(chats::deleted_at.is_null()) .filter(chats::organization_id.eq(organization_id)) .filter(chats::title.ne("")) // Filter out empty titles + .filter(chats::title.ne(" ")) // Filter out single space .into_boxed(); // Calculate offset based on page number @@ -112,6 +113,7 @@ pub async fn list_logs_handler( let has_more = results.len() > request.page_size as usize; let items: Vec = results .into_iter() + .filter(|chat| !chat.title.trim().is_empty()) // Filter out titles with only whitespace .take(request.page_size as usize) .map(|chat| { LogListItem {