Messages now actually gets deleted

This commit is contained in:
2026-03-09 22:12:08 +01:00
parent a55694af8e
commit 3b1aab4985
12 changed files with 536 additions and 277 deletions

View File

@@ -10,18 +10,22 @@ import { ReactionEntity } from '../entities/ReactionEntity';
import { BanEntity } from '../entities/BanEntity';
import { AttachmentEntity } from '../entities/AttachmentEntity';
const DELETED_MESSAGE_CONTENT = '[Message deleted]';
export function rowToMessage(row: MessageEntity) {
const isDeleted = !!row.isDeleted;
return {
id: row.id,
roomId: row.roomId,
channelId: row.channelId ?? undefined,
senderId: row.senderId,
senderName: row.senderName,
content: row.content,
content: isDeleted ? DELETED_MESSAGE_CONTENT : row.content,
timestamp: row.timestamp,
editedAt: row.editedAt ?? undefined,
reactions: JSON.parse(row.reactions || '[]') as unknown[],
isDeleted: !!row.isDeleted,
reactions: isDeleted ? [] : JSON.parse(row.reactions || '[]') as unknown[],
isDeleted,
replyToId: row.replyToId ?? undefined
};
}