Skip to content

Commit 546a13c

Browse files
committed
hotfix: pictique and blabsy chat
1 parent 757e768 commit 546a13c

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

platforms/blabsy/src/components/chat/chat-list.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export function ChatList(): JSX.Element {
9393

9494
return (
9595
<div className='flex h-full flex-col'>
96-
<div className='flex-1 overflow-y-auto p-4 space-y-2'>
96+
<div className='flex-1 overflow-y-auto overflow-x-hidden px-2 py-2 space-y-1'>
9797
{chats.map((chat) => {
9898
const otherParticipant = chat.participants.find(
9999
(p) => p !== user?.id
@@ -107,7 +107,7 @@ export function ChatList(): JSX.Element {
107107
key={chat.id}
108108
type='button'
109109
onClick={() => setCurrentChat(chat)}
110-
className={`flex items-center gap-3 rounded-lg p-3 transition-colors ${
110+
className={`w-full flex items-center gap-3 rounded-lg p-3 transition-colors ${
111111
currentChat?.id === chat.id
112112
? 'bg-gray-200 dark:bg-gray-700 border-l-4 border-primary'
113113
: 'hover:bg-gray-50 dark:hover:bg-gray-800'
@@ -160,7 +160,7 @@ export function ChatList(): JSX.Element {
160160
);
161161
})}
162162
</div>
163-
<div className='flex-shrink-0 p-4'>
163+
<div className='flex-shrink-0 px-2 py-2'>
164164
<button
165165
type='button'
166166
onClick={() => setOpenCreateNewChatModal(true)}

platforms/pictique-api/src/services/ChatService.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -285,19 +285,12 @@ export class ChatService {
285285
page: number;
286286
totalPages: number;
287287
}> {
288-
// Get chats ordered by the most recent message timestamp
288+
// First, get all chats for the user with basic info
289289
const queryBuilder = this.chatRepository
290290
.createQueryBuilder("chat")
291-
.leftJoin("chat.messages", "message")
292291
.innerJoin("chat.participants", "participants")
293292
.where("participants.id = :userId", { userId })
294-
.groupBy("chat.id")
295-
.addGroupBy("chat.name")
296-
.addGroupBy("chat.ename")
297-
.addGroupBy("chat.createdAt")
298-
.addGroupBy("chat.updatedAt")
299-
.orderBy("MAX(message.createdAt)", "DESC")
300-
.addOrderBy("chat.createdAt", "DESC"); // Fallback for chats without messages
293+
.orderBy("chat.updatedAt", "DESC");
301294

302295
// Get total count for pagination
303296
const total = await queryBuilder.getCount();
@@ -320,7 +313,7 @@ export class ChatService {
320313
],
321314
});
322315

323-
// Sort the chats by latest message timestamp (since we loaded relations, we need to sort again)
316+
// Sort the chats by latest message timestamp (most recent first)
324317
const sortedChats = chatsWithRelations.sort((a, b) => {
325318
const aLatestMessage = a.messages[a.messages.length - 1];
326319
const bLatestMessage = b.messages[b.messages.length - 1];

0 commit comments

Comments
 (0)