Escape external text in Telegram notifications
What does this MR do and why?
Telegram notifications now use the HTML style of the Telegram Bot API instead of legacy Markdown. External text is escaped while generated links and bold titles remain formatted. The HTTP 400 plain-text retry retains readable URLs. Link preview behavior is unchanged.
References
- Related issue: #431467 (closed)
- Related merge request: !148703 (merged)
Screenshots or screen recordings
The screenshots show delivery through the production formatter and notifier to the real Telegram API. Rails model and factory wiring was stubbed, so this was not a full GDK webhook event test. Link previews were disabled for these screenshots; this MR retains the existing preview behavior.
How to set up and validate locally
- Configure a test Telegram integration for a project and chat.
- Trigger note, issue, merge request, wiki, push, and pipeline notifications using synthetic names, titles, and branch names containing
&,<,>,_,*, and backticks. - Confirm those characters display literally, generated links open their destinations, and notification titles retain their intended formatting.
- In development, force the formatted request to return HTTP 400 and confirm the retry shows plain text with destination URLs.
Automated checks
98 selected isolated regression examples passed after rebasing onto master, using the production message classes, current Slack sanitizer, and ActionView, with Rails model and factory wiring stubbed. The upstream HTML-like removed-branch regression reproduced the CI failure before the compatibility fix and passes afterward; Telegram HTML and HTTP 400 fallback checks also pass. Native CI results are available on the MR pipelines page.
MR acceptance checklist
Reviewed message generation across supported Telegram event types and checked the default paths for other chat integrations. Regression tests cover actor and project names, issue/MR/wiki titles, removed branch refs, pipeline project/ref/user text, vulnerability project links, URL attributes, repeated helper calls, and plaintext retry URLs. Configuration, the public API, and link preview behavior are unchanged. User documentation remains unchanged.
AI assistance
This contribution uses AI-generated content. OpenAI Codex assisted with the implementation, test drafting, and review.

