Commit a60b2d4b authored by Tetiana Chupryna's avatar Tetiana Chupryna

Merge branch '341849_cleanup_reference_cache_memoization_ff' into 'master'

Cleanup feature flag "reference_cache_memoization"

See merge request gitlab-org/gitlab!74511

Changelog: other
parents 58e868b1 b5c7b417
---
name: reference_cache_memoization
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/71310
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/341849
milestone: '14.4'
type: development
group: group::source code
default_enabled: true
......@@ -29,7 +29,7 @@ module Banzai
@references_per_parent[parent_type] ||= begin
refs = Hash.new { |hash, key| hash[key] = Set.new }
prepare_doc_for_scan(filter.doc).to_enum(:scan, regex).each do
prepare_doc_for_scan.to_enum(:scan, regex).each do
parent_path = if parent_type == :project
full_project_path($~[:namespace], $~[:project])
else
......@@ -184,14 +184,12 @@ module Banzai
Gitlab::SafeRequestStore["banzai_#{parent_type}_refs".to_sym] ||= {}
end
def prepare_doc_for_scan(doc)
html = if Feature.enabled?(:reference_cache_memoization, project, default_enabled: :yaml)
result[:rendered_html] ||= doc.to_html
else
doc.to_html
end
def prepare_doc_for_scan
filter.requires_unescaping? ? unescape_html_entities(html_content) : html_content
end
filter.requires_unescaping? ? unescape_html_entities(html) : html
def html_content
result[:rendered_html] ||= filter.doc.to_html
end
def unescape_html_entities(text)
......
......@@ -35,18 +35,6 @@ RSpec.describe Banzai::Filter::References::ReferenceCache do
subject
end
context 'when feature flag is disabled' do
before do
stub_feature_flags(reference_cache_memoization: false)
end
it 'ignores memoized rendered HTML' do
expect(doc).to receive(:to_html).and_call_original
subject
end
end
end
context 'when result is not available' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment