Messages now actually gets deleted
This commit is contained in:
@@ -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
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user