fix(backend/dm): include attachmentUrl + replyTo in history response

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 <noreply@anthropic.com>
This commit is contained in:
chahinebrini 2026-05-16 08:49:59 +02:00
parent 6bbf9e4cfd
commit 2cc0b20fc8

View File

@ -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,
})),
};
});