mirror of
https://github.com/chatwoot/chatwoot.git
synced 2026-06-04 21:02:35 +08:00
# Pull Request Template ## Description This PR fixes an issue where outgoing Email messages (via API) do not preserve single line breaks in rendered HTML. #### Cause Messages are stored with `\n`, but rendering differs: * **Other channel** (`markdown-it`, `breaks: true`) → `\n` → `<br>` * **Email** (CommonMark) without `HARDBREAKS` → `\n` collapsed into spaces Result: multi-line messages appear as a single paragraph in Email. #### Solution * Added `hardbreaks:` option to `render_message` (default: false) * Enabled `hardbreaks: true` in `EmailHelper#render_email_html` This ensures `\n` renders as `<br />` in Email, matching web widget behavior. Fixes https://linear.app/chatwoot/issue/CW-6941/outgoing-email-messages-strip-single-newlines-from-plain-text-content ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? #### Screenshots **Before** <img width="604" height="104" alt="image" src="https://github.com/user-attachments/assets/f9086ffb-a5c7-4688-99aa-97ea5edcccde" /> **After** <img width="604" height="210" alt="image" src="https://github.com/user-attachments/assets/a8f21c76-bcb8-4058-937a-dd185fb6745c" /> ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com> |
||
|---|---|---|
| .. | ||
| action_view/template/handlers | ||
| assets | ||
| captain | ||
| custom_exceptions | ||
| events | ||
| filters | ||
| integrations | ||
| linear | ||
| llm | ||
| redis | ||
| safe_fetch | ||
| seeders | ||
| tasks | ||
| test_data | ||
| webhooks | ||
| base_markdown_renderer.rb | ||
| chatwoot_app.rb | ||
| chatwoot_captcha.rb | ||
| chatwoot_exception_tracker.rb | ||
| chatwoot_hub.rb | ||
| chatwoot_markdown_renderer.rb | ||
| config_loader.rb | ||
| current.rb | ||
| custom_markdown_renderer.rb | ||
| dyte.rb | ||
| exception_list.rb | ||
| global_config_service.rb | ||
| global_config.rb | ||
| limits.rb | ||
| linear.rb | ||
| llm_constants.rb | ||
| microsoft_graph_auth.rb | ||
| online_status_tracker.rb | ||
| opentelemetry_config.rb | ||
| regex_helper.rb | ||
| safe_fetch.rb | ||
| test_data.rb | ||
| url_helper.rb | ||
| vapid_service.rb | ||