Skip to content

Empty markdown was correctly cached as empty html but then treated as out of date

What does this MR do?

Empty markdown generates empty rendered HTML which was always treated as uncached. This caused a pointless redundant UPDATE on every view of an issue such as sytses/test-2#1

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

This code will still not handle things correctly if the markdown is non-empty and the rendered html is empty e.g.:

Banzai::Renderer.cacheless_render('[//]: # (This is also a comment.)', {project: nil})
=> ""

Perhaps we should just rip out all the tests for .present? and treat empty strings as valid markdown/html? Perhaps they should be all be testing .nil??

Why was this MR needed?

Screenshots (if relevant)

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/27164

Edited by Gregory Stark

Merge request reports