summaryrefslogtreecommitdiff
path: root/lib/gitlab/diff/highlight_cache.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/diff/highlight_cache.rb')
-rw-r--r--lib/gitlab/diff/highlight_cache.rb18
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/gitlab/diff/highlight_cache.rb b/lib/gitlab/diff/highlight_cache.rb
index 7932cd2a837..c5e9bfdc321 100644
--- a/lib/gitlab/diff/highlight_cache.rb
+++ b/lib/gitlab/diff/highlight_cache.rb
@@ -7,8 +7,7 @@ module Gitlab
include Gitlab::Utils::StrongMemoize
EXPIRATION = 1.week
- VERSION = 1
- NEXT_VERSION = 2
+ VERSION = 2
delegate :diffable, to: :@diff_collection
delegate :diff_options, to: :@diff_collection
@@ -70,20 +69,17 @@ module Gitlab
def key
strong_memoize(:redis_key) do
- ['highlighted-diff-files', diffable.cache_key, version, diff_options].join(":")
+ [
+ 'highlighted-diff-files',
+ diffable.cache_key, VERSION,
+ diff_options,
+ Feature.enabled?(:introduce_marker_ranges, diffable.project, default_enabled: :yaml)
+ ].join(":")
end
end
private
- def version
- if Feature.enabled?(:improved_merge_diff_highlighting, diffable.project, default_enabled: :yaml)
- NEXT_VERSION
- else
- VERSION
- end
- end
-
def set_highlighted_diff_lines(diff_file, content)
diff_file.highlighted_diff_lines = content.map do |line|
Gitlab::Diff::Line.safe_init_from_hash(line)