Add conversation pinning: pinned chats stay at top of sidebar
Build & Auto-Repair / build (push) Has been cancelled

This commit is contained in:
JCBSComputer
2026-07-02 16:09:07 +02:00
parent 4c732c850f
commit 211d026fb8
4 changed files with 78 additions and 6 deletions
+3 -1
View File
@@ -13,6 +13,7 @@ export async function GET() {
c.id,
c.updated_at,
cp_me.last_read_at,
cp_me.pinned_at,
u.id AS other_user_id,
u.first_name || ' ' || u.last_name AS other_user_name,
u.email AS other_user_email,
@@ -28,7 +29,7 @@ export async function GET() {
WHERE c.id IN (
SELECT conversation_id FROM conversation_participants WHERE user_id = $1
)
ORDER BY c.updated_at DESC
ORDER BY cp_me.pinned_at DESC NULLS LAST, c.updated_at DESC
LIMIT 50`,
[user.id],
)
@@ -36,6 +37,7 @@ export async function GET() {
const conversations = result.rows.map((row: any) => ({
id: row.id,
updatedAt: row.updated_at,
pinned: row.pinned_at !== null,
otherUser: {
id: row.other_user_id,
name: row.other_user_name,