Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/integration-scripts-no-babel.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@rocket.chat/meteor': major
'@rocket.chat/meteor': patch
---

**Breaking:** Stopped transpiling webhook integration scripts with Babel. Scripts now run as-is inside `isolated-vm` (modern V8).
Expand Down
5 changes: 5 additions & 0 deletions .changeset/thin-news-rhyme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Remove backend auto-close unclosed markdown code blocks (handled client-side since 9.0.0)
7 changes: 0 additions & 7 deletions apps/meteor/server/services/messages/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import { BeforeSaveMarkdownParser } from './hooks/BeforeSaveMarkdownParser';
import { mentionServer } from './hooks/BeforeSaveMentions';
import { BeforeSavePreventMention } from './hooks/BeforeSavePreventMention';
import { BeforeSaveSpotify } from './hooks/BeforeSaveSpotify';
import { closeUnclosedCodeBlock } from '../../../lib/utils/closeUnclosedCodeBlock';
import { shouldBreakInVersion } from '../../lib/shouldBreakInVersion';

const disableMarkdownParser = ['yes', 'true'].includes(String(process.env.DISABLE_MESSAGE_PARSER).toLowerCase());

Expand Down Expand Up @@ -238,11 +236,6 @@ export class MessageService extends ServiceClassInternal implements IMessageServ

message = await this.cannedResponse.replacePlaceholders({ message, room, user });
message = await this.badWords.filterBadWords({ message });
// TODO: Auto-close unclosed markdown code blocks for server versions below 9.0.0
// In 9.0.0, this behavior is handled on the client side, so this block should be removed.
if (!shouldBreakInVersion('9.0.0') && message.msg) {
message = { ...message, msg: closeUnclosedCodeBlock(message.msg) };
}
message = await this.markdownParser.parseMarkdown({ message, config: this.getMarkdownConfig() });
message = await mentionServer.execute(message);
if (parseUrls) {
Expand Down
21 changes: 0 additions & 21 deletions apps/meteor/tests/end-to-end/api/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1871,27 +1871,6 @@ describe('[Chat]', () => {
});
});
});

// TODO: Auto-close unclosed markdown code blocks on backend - Remove in 9.0.0
// In 9.0.0, this behavior is handled entirely on the client side and should no longer be done on the backend.
it('should auto-close an unclosed code block when sending a message', async () => {
const unclosedMsg = '```\nsome code';
const expectedMsg = '```\nsome code\n```';
await request
.post(api('chat.sendMessage'))
.set(credentials)
.send({
message: {
rid: testChannel._id,
msg: unclosedMsg,
},
})
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.nested.property('message.msg', expectedMsg);
});
});
});

Expand Down