Fix broken XHTML in Atom feed for notes with line breaks

What does this MR do and why?

Notes in the project activity Atom feed were rendered using markdown_field, which uses the default Banzai pipeline and produces standard HTML with bare <br> tags. The <summary type="xhtml"> element in the Atom feed requires valid XHTML, where <br> must be self-closing (<br />).

This fix adds the missing Events::RenderService call with atom_request: true in ProjectsController#show for the atom format, consistent with GroupsController, UsersController, and Dashboard::ProjectsController. This pre-renders and caches the events using the correct XHTML-aware pipeline, so that markdown_field in the view produces self-closing <br /> tags.

Note: the _event_note.atom.haml view continues to use markdown_field(note, :note) (rather than markdown(note.note, pipeline: :atom, ...)), which allows it to use the pre-rendered cache from Events::RenderService and avoids per-note re-rendering with all its associated lookups.

References

Fixes #361722

Screenshots or screen recordings

Before After

<summary type="html"><p data-sourcepos="1:1-1:10" dir="auto">foo<br>bar</p></summary>

image.png

<summary type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><p dir="auto">foo<br />bar</p></div></summary>

image.png

How to set up and validate locally

  1. Post a comment with a line break on any issue
  2. Visit the project activity Atom feed at http://localhost:3000/group/project.atom?private_token=TOKEN
  3. Before fix: feed contains bare <br> tags, producing invalid XML
  4. After fix: feed contains self-closing <br />, producing valid XHTML

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Tanvir Singh

Merge request reports

Loading