From 2cc0b20fc8fae40edcf16213fa6dd319e0cc8eae Mon Sep 17 00:00:00 2001 From: chahinebrini Date: Sat, 16 May 2026 08:49:59 +0200 Subject: [PATCH] fix(backend/dm): include attachmentUrl + replyTo in history response MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Map-response dropped attachment fields and reply reference even though getDmHistory loads them — caused images and reply quotes to disappear on conversation re-open. Co-Authored-By: Claude Opus 4.7 --- backend/server/api/chat/dm/[userId].get.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/backend/server/api/chat/dm/[userId].get.ts b/backend/server/api/chat/dm/[userId].get.ts index 4cdb999..fcbab37 100644 --- a/backend/server/api/chat/dm/[userId].get.ts +++ b/backend/server/api/chat/dm/[userId].get.ts @@ -27,10 +27,23 @@ export default defineEventHandler(async (event) => { : { id: partnerId, nickname: "Anonym", username: "anonym", avatar: null }, messages: [...messages].reverse().map((m) => ({ id: m.id, + senderId: m.senderId, + receiverId: m.receiverId, content: m.content, createdAt: m.createdAt, isOwn: m.senderId === user.id, readAt: m.readAt, + attachmentUrl: m.attachmentUrl, + attachmentType: m.attachmentType, + attachmentName: m.attachmentName, + likesCount: m.likesCount, + replyTo: m.replyTo + ? { + id: m.replyTo.id, + senderId: m.replyTo.senderId, + content: m.replyTo.content, + } + : null, })), }; });