Support for rendering/redacting multiple documents

Merged yorickpeterse-staging requested to merge refactor-rendering-redacting into master

What does this MR do?

This MR does two things:

  1. Separate redacting HTML documents from the htm-pipeline Gem and support redacting multiple documents at once
  2. Add code that supports rendering and redacting multiple Markdown documents

See commit d7dc68ef878d2ad032efa92e25a8fa77250f9099 for more information.

Are there points in the code the reviewer needs to double check?

Yes. The way notes are currently gathered in the controllers is something I'm not very fond of.

Why was this MR needed?

Most of this is explained in d7dc68ef878d2ad032efa92e25a8fa77250f9099 but in short:

  • Redacting happened per document, leading to lots of queries being executed for every comment.
  • On between 1 and ~2.5 seconds is spent in redacting documents per request to Projects::IssuesController#show
  • Redacting multiple documents at once greatly reduces the number of SQL queries executed.

What are the relevant issue numbers?

#18581 (closed)

Screenshots (if relevant)

Before/after of the method timings:


Here the green bars are the timings for the RedactorFilter#call method, the orange-ish timings are for Banzai::Redactor#redact.

SQL query count impact:


Here the big drop just before 12:30 is when I switched to the branch of this MR, the number of queries dropped from around 4000 to around 2600.

Does this MR meet the acceptance criteria?