Pinned conversations no longer move on click or new messages
Build & Auto-Repair / build (push) Has been cancelled

This commit is contained in:
JCBSComputer
2026-07-02 16:13:49 +02:00
parent 211d026fb8
commit abcef070c3
2 changed files with 9 additions and 6 deletions
+8 -5
View File
@@ -510,10 +510,13 @@ const formatPreviewContent = (content: string) => {
? { ...conv, lastMessage: getDisplayContent(content), lastMessageTime: "Just now" }
: conv
)
const idx = updated.findIndex((c) => c.id === activeChat)
if (idx > 0) {
const [item] = updated.splice(idx, 1)
updated.unshift(item)
const conv = updated.find((c) => c.id === activeChat)
if (conv && !conv.pinned) {
const idx = updated.findIndex((c) => c.id === activeChat)
if (idx > 0) {
const [item] = updated.splice(idx, 1)
updated.unshift(item)
}
}
return updated
})
@@ -842,7 +845,7 @@ const formatPreviewContent = (content: string) => {
setUnreadMap((prev) => { const m = new Map(prev); m.set(conv.id, 0); return m })
setConversations((prev) => {
const idx = prev.findIndex((c) => c.id === conv.id)
if (idx > 0) {
if (idx > 0 && !conv.pinned) {
const u = [...prev]
const [item] = u.splice(idx, 1)
u.unshift(item)
+1 -1
View File
@@ -29,7 +29,7 @@ export async function GET() {
WHERE c.id IN (
SELECT conversation_id FROM conversation_participants WHERE user_id = $1
)
ORDER BY cp_me.pinned_at DESC NULLS LAST, c.updated_at DESC
ORDER BY cp_me.pinned_at DESC NULLS LAST, CASE WHEN cp_me.pinned_at IS NULL THEN c.updated_at END DESC
LIMIT 50`,
[user.id],
)