mirror of https://github.com/buster-so/buster.git
Filter out chats with empty or whitespace-only titles
Co-authored-by: dallin <dallin@buster.so>
This commit is contained in:
parent
2cd3f0696f
commit
48027dccb9
|
@ -106,6 +106,7 @@ pub async fn list_chats_handler(
|
||||||
.inner_join(users::table.on(chats::created_by.eq(users::id)))
|
.inner_join(users::table.on(chats::created_by.eq(users::id)))
|
||||||
.filter(chats::deleted_at.is_null())
|
.filter(chats::deleted_at.is_null())
|
||||||
.filter(chats::title.ne("")) // Filter out empty titles
|
.filter(chats::title.ne("")) // Filter out empty titles
|
||||||
|
.filter(chats::title.ne(" ")) // Filter out single space
|
||||||
.into_boxed();
|
.into_boxed();
|
||||||
|
|
||||||
// Add user filter if not admin view
|
// 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 has_more = results.len() > request.page_size as usize;
|
||||||
let items: Vec<ChatListItem> = results
|
let items: Vec<ChatListItem> = results
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
.filter(|chat| !chat.title.trim().is_empty()) // Filter out titles with only whitespace
|
||||||
.take(request.page_size as usize)
|
.take(request.page_size as usize)
|
||||||
.map(|chat| {
|
.map(|chat| {
|
||||||
ChatListItem {
|
ChatListItem {
|
||||||
|
|
|
@ -79,6 +79,7 @@ pub async fn list_logs_handler(
|
||||||
.filter(chats::deleted_at.is_null())
|
.filter(chats::deleted_at.is_null())
|
||||||
.filter(chats::organization_id.eq(organization_id))
|
.filter(chats::organization_id.eq(organization_id))
|
||||||
.filter(chats::title.ne("")) // Filter out empty titles
|
.filter(chats::title.ne("")) // Filter out empty titles
|
||||||
|
.filter(chats::title.ne(" ")) // Filter out single space
|
||||||
.into_boxed();
|
.into_boxed();
|
||||||
|
|
||||||
// Calculate offset based on page number
|
// 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 has_more = results.len() > request.page_size as usize;
|
||||||
let items: Vec<LogListItem> = results
|
let items: Vec<LogListItem> = results
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
.filter(|chat| !chat.title.trim().is_empty()) // Filter out titles with only whitespace
|
||||||
.take(request.page_size as usize)
|
.take(request.page_size as usize)
|
||||||
.map(|chat| {
|
.map(|chat| {
|
||||||
LogListItem {
|
LogListItem {
|
||||||
|
|
Loading…
Reference in New Issue