summaryrefslogtreecommitdiff
path: root/app/models/concerns
diff options
context:
space:
mode:
authorBrett Walker <bwalker@gitlab.com>2019-01-29 10:46:04 -0600
committerFatih Acet <acetfatih@gmail.com>2019-01-30 23:18:20 +0100
commit58cd21c2ad802c1652311f025c599e0df604669c (patch)
tree0b0ed65bc247bc3d8dfdcd1bfa477ee57a58faff /app/models/concerns
parenta3a847f8624b5f5b10d5665725df2090a1f631ba (diff)
downloadgitlab-ce-58cd21c2ad802c1652311f025c599e0df604669c.tar.gz
Use the sourcepos attribute for finding tasks
Diffstat (limited to 'app/models/concerns')
-rw-r--r--app/models/concerns/cache_markdown_field.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/concerns/cache_markdown_field.rb b/app/models/concerns/cache_markdown_field.rb
index 0ccc03db15a..588204c7470 100644
--- a/app/models/concerns/cache_markdown_field.rb
+++ b/app/models/concerns/cache_markdown_field.rb
@@ -15,7 +15,7 @@ module CacheMarkdownField
# Increment this number every time the renderer changes its output
CACHE_REDCARPET_VERSION = 3
CACHE_COMMONMARK_VERSION_START = 10
- CACHE_COMMONMARK_VERSION = 13
+ CACHE_COMMONMARK_VERSION = 14
# changes to these attributes cause the cache to be invalidates
INVALIDATED_BY = %w[author project].freeze
@@ -130,13 +130,17 @@ module CacheMarkdownField
def latest_cached_markdown_version
return CacheMarkdownField::CACHE_COMMONMARK_VERSION unless cached_markdown_version
- if cached_markdown_version < CacheMarkdownField::CACHE_COMMONMARK_VERSION_START
+ if legacy_markdown?
CacheMarkdownField::CACHE_REDCARPET_VERSION
else
CacheMarkdownField::CACHE_COMMONMARK_VERSION
end
end
+ def legacy_markdown?
+ cached_markdown_version && cached_markdown_version.between?(1, CacheMarkdownField::CACHE_COMMONMARK_VERSION_START - 1)
+ end
+
included do
cattr_reader :cached_markdown_fields do
FieldData.new