fix: #10491, don't leak deleted message in cleanedContent

isekai-main
Barış Soner Uşaklı 3 years ago
parent 7c733e9cf1
commit c52401da02

@ -48,6 +48,7 @@ Messaging.getMessages = async (params) => {
messageData.isOwner = messageData.fromuid === parseInt(params.uid, 10); messageData.isOwner = messageData.fromuid === parseInt(params.uid, 10);
if (messageData.deleted && !messageData.isOwner) { if (messageData.deleted && !messageData.isOwner) {
messageData.content = '[[modules:chat.message-deleted]]'; messageData.content = '[[modules:chat.message-deleted]]';
messageData.cleanedContent = messageData.content;
} }
}); });

@ -702,6 +702,7 @@ describe('Messaging Library', () => {
assert.ifError(err); assert.ifError(err);
messages.forEach((msg) => { messages.forEach((msg) => {
assert(!msg.deleted || msg.content === '[[modules:chat.message-deleted]]', msg.content); assert(!msg.deleted || msg.content === '[[modules:chat.message-deleted]]', msg.content);
assert(!msg.deleted || msg.cleanedContent, '[[modules:chat.message-deleted]]', msg.content);
}); });
done(); done();
} }

Loading…
Cancel
Save